日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

winsock select

發布時間:2023/11/27 生活经验 52 豆豆
生活随笔 收集整理的這篇文章主要介紹了 winsock select 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
MSDN中,有:

select

The select function determines the status of one or more sockets, waiting if necessary, to perform synchronous I/O.

int select(int nfds,
  fd_set* readfds,
  fd_set* writefds,
  fd_set* exceptfds,
  const struct timeval* timeout
);
Parameters
nfds
[in] Ignored. The nfds parameter is included only for compatibility with Berkeley sockets.
readfds
[in, out] Optional pointer to a set of sockets to be checked for readability.
writefds
[in, out] Optional pointer to a set of sockets to be checked for writability.
exceptfds
[in, out] Optional pointer to a set of sockets to be checked for errors.
timeout
[in] Maximum time for select to wait, provided in the form of a TIMEVAL structure. Set the timeout parameter to null for blocking operations.

?

?

?

http://hi.baidu.com/ytmayer/blog/item/602698667aa09422aa184cfd.html中,有:

struct timeval* timeout是select的超時時間,這個參數至關重要,它可以使select處于三種狀態。

第一,若將NULL以形參傳入,即不傳入時間結構,就是將select置于阻塞狀態,一定等到監視文件描述符集合中某個文件描述符發生變化為止;第二,若將時間值設為0秒0毫秒,就變成一個純粹的非阻塞函數,不管文件描述符是否有變化,都立刻返回繼續執行,文件無變化返回0,有變化返回一個正值;第三,timeout的值大于0,這就是等待的超時時間,即select在timeout時間內阻塞,超時時間之內有事件到來就返回了,否則在超時后不管怎樣一定返回,返回值同上述。

轉載于:https://www.cnblogs.com/WeRtogether/archive/2009/10/12/1581516.html

總結

以上是生活随笔為你收集整理的winsock select的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。