winsock:
int select (
int nfds,
fd_set FAR * readfds,
fd_set FAR * writefds,
fd_set FAR * exceptfds,
const struct timeval FAR * timeout);
nfds
[in] This parameter is ignored; it is included only for compatibility with Berkeley sockets.
unix posix:
int select(int nfds,
fd_set *readfds,
fd_set *writefds,
fd_set *errorfds,
struct timeval *timeout);
The nfds argument specifies the range of file descriptors to be tested. The select() function tests file descriptors in the range of 0 to nfds-1.
winsock此参数忽略无效,unix posix中必须有实际的意义,代表文件描述符的范围。
博客介绍了winsock和unix posix中select函数的定义。winsock的select函数中,nfds参数被忽略,仅为兼容Berkeley套接字;而在unix posix中,nfds参数有实际意义,指定了要测试的文件描述符范围。
1846

被折叠的 条评论
为什么被折叠?



