select 详解

In summary, a socket will be identified in a particular set when select returns if:

readfds:
If listen has been called and a connection is pending, accept will succeed.
Data is available for reading (includes OOB data if SO_OOBINLINE is enabled).
Connection has been closed/reset/terminated.

writefds:
If processing a connect call (nonblocking), connection has succeeded.
Data can be sent.

exceptfds:
If processing a connect call (nonblocking), connection attempt failed.
OOB data is available for reading (only if SO_OOBINLINE is disabled).

posted @ 2019-04-01 13:48  mingzhang  阅读(315)  评论(0编辑  收藏  举报