会员
周边
众包
新闻
博问
闪存
赞助商
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
川页科技
2019年4月26日
非阻塞connect
摘要: int connect_nonb(int sockfd, const SA *saptr, socklen_t salen, int nsec) { int flags, n, error; socklen_t len; fd_set rset, wset; struct timeval tval; ...
阅读全文
posted @ 2019-04-26 21:52 soldierback
阅读(267)
评论(0)
推荐(0)
编辑
使用fork的str_cli函数
摘要: void str_cli(FILE *fp, int sockfd) { pid_t pid; char sendline[MAXLINE], recvline[MAXLINE]; if ( (pid = fork()) == 0) { /* child: server -> stdout */ while (read(sock...
阅读全文
posted @ 2019-04-26 20:51 soldierback
阅读(173)
评论(0)
推荐(0)
编辑
非阻塞读和写:str_cli函数
摘要: void str_cli(FILE *fp, int sockfd) { int maxfdp1, val, stdineof; ssize_t n, nwritten; fd_set rset, wset; char to[MAXLINE], fr[MAXLINE]; char *toiptr, *to...
阅读全文
posted @ 2019-04-26 20:40 soldierback
阅读(341)
评论(0)
推荐(0)
编辑
公告
导航
博客园
首页
新随笔
新文章
联系
订阅
管理