易截截图软件、单文件、免安装、纯绿色、仅160KB

linux下tcp服务器源码示例

#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
struct _NSS_HEADER
{
unsigned short ProtocolVersion; /* 协议版本信息 */
unsigned short MsgType; /* 消息类型 */
unsigned short TransactionNo; /* 传输编号 */
unsigned short PacketLength; /* 数据包长度,包括Header */
}NSS_HEADER;
void str_echo(int sockfd)
{
ssize_t readLen;
ssize_t writeLen;
char buf[8];
while ( true )
{
readLen = read(sockfd, buf, 8);
if (readLen < 0 && errno == EINTR)
{
continue;
}
else if ( readLen <= 0 )
{
perror( "read:");
return ;
}
printf( "recv data successed. data len: %d\n", readLen );
int nWriteLen = 0;
while ( true )
{
writeLen == write(sockfd, &buf[nWriteLen], readLen-nWriteLen);
if (writeLen < 0 && errno == EINTR)
{
continue;
}
else if ( writeLen < 0 )
{
perror ( "write:" );
return;
}
nWriteLen += writeLen;
// 已写完,直接返回
if (nWriteLen >= readLen )
{
break;
}
}
printf( "send data successed. data len: %d\n", readLen );
}
}
int main(int argc, char **argv)
{
printf( "server ip: %s\n", argv[1] );
printf( "server port: %s\n", argv[2] );
printf( "\nservice starting ... \n\n" );
int listenfd, connfd;
pid_t childpid;
socklen_t clilen;
struct sockadd


相关文档:

实战Linux Bluetooth编程(三) HCI层编程

1. HCI层协议概述:
HCI提供一套统一的方法来访问Bluetooth底层。如图所示:
从图上可以看出,Host Controller Interface(HCI)  就是用来沟通Host和Module。Host通常就是PC, Module则是以各种物理连接形式(USB,serial,pc-card等)连接到PC上的bluetooth Dongle。
在Host这一端:application,SDP,L2cap等协议 ......

Linux 下 将PDF文件中的文本,图片导出的方法。


PDF格式文件中的文本是可以导出来再修改的。
同样,PDF里面的插图也是可以提取出来的。
PDF转纯文本:
pdftotext -enc GBK godson2e-data.Sheet.pdf text.GBK.txt
-enc (encoding)
要参照/etc/xpdf/xpdfrc 里面提到的编码格式。对于中文,用GBK
就可以了。
提取插图:
pdfimages godson2e-data.Sheet.pdf img
该 ......

修改linux启动参数挽回/etc/inittab文件

最近做linux系统裁剪,修改嵌入式系统的inittab文件时误将本机inittab文件修改。
reboot后出现
INIT: /etc/inittab[2]: missing id field
INIT: /etc/inittab[3]: missing id field.
Enterrunlevel:
输入3,或1,或singgle后出现
INIT: no more processess left in this runlevel
系统停止。
google,baidu到一篇引 ......

Linux查看文件夹大小的命令

[root@ns1 opt]#  du -h -s /* | sort
12K     /mnt
13M     /sbin
16K     /lost+found
1.8G    /usr
194M    /root
22G     /opt
24K     /tmp
4.0K&n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号