Details
The first argument (nfds) represents the number of bits in the masks that will be processed. Typically, this is 1 + the value of the highest fd
The three fd_set arguments are bit masks … their manipulation is discussed on the next slide
The last argument specifies the amount of time the select call should wait before completing its action and returning:
- if NULL, select will wait (block) indefinitely until one of the file descriptors is ready for i/o
- if tv_sec and tv_usec are zero, select will return immediately
- if timeval members are non-zero, the system will wait the specified time or until a file descriptor is ready for i/o
select() returns the number or file descriptors ready for i/o