int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
The first parameter is select , nfds should be the maximum file descriptor plus 1, which should be at least 1.
But I saw some codes set nfds to 0, is this use legal?
In addition, the return value of select set to EINVAL when nfds negative, or timeout contains an invalid value. Again, it does not indicate what happened when nfds is 0.
source share