Select Model

Use select to manage the IO

determining one or more sockets select state.

int select(
int nfds;
fd_set* readfds;  //可读性
fs_set* writefds; // 可写性
fd_set* exceptfds; //错误
const struct timeval* timeout   //等待时间
);

Function succeeds, returns the sum of the number of sockets.

Time limit is exceeded, return to 0;

Failure to return SOCKET_ERROR.

Reproduced in: https: //my.oschina.net/u/204616/blog/545369

Guess you like

Origin blog.csdn.net/weixin_34221276/article/details/91989308