博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2011年4月20日

摘要: 函数原型为: #include <netinet/socket.h> int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen); Return: 0 if OK, –1 on error 这个函数用于获得socket的各种特性,即socket options. 结果放在函数的后两个参数中,... 阅读全文

posted @ 2011-04-20 14:27 天地玄黄 阅读(19014) 评论(1) 推荐(0)

摘要: The following is the code coming from Uinx Network Programming on page 235: int flags; /* set a socket as nonblocking */if( (flags = fcntl(fd, F_GETFL, 0)) < 0) err_sys("F_GETFL error");flags |= O_NON... 阅读全文

posted @ 2011-04-20 10:48 天地玄黄 阅读(321) 评论(0) 推荐(0)