`
chaotang0281
  • 浏览: 46430 次
  • 性别: Icon_minigender_2
  • 来自: 威海
社区版块
存档分类
最新评论

关于select 函数

 
阅读更多

关于select 函数,网上有很多例子。函数原型是:


int select(int n,fd_set * readfds,fd_set * writefds,fd_set * exceptfds,struct timeval * timeout);


有个参数是 readfds和writefds,我在调用这个函数的时候,两个都是设为非空,结果,运行老是出错,不是想要的结果。


所以在使用select 函数时, 这三个 fd_set 只能一个为非空,。

像这样调用,就得不到想要结果 : select(sockfd, rfds, wfds, NULL, NULL).

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics