tcp_select()
     #include "tcp.h"
     
     int FD,Block;
     double Timeout;
     
     ...
     
     switch (tcp_select(Block, Timeout, &FD))
     {
     case tcp_ERROR:
         ... an error occurred.
     case tcp_TIMEOUT:
         ... handle a timeout
     case tcp_SUCCESS:
         ... input is ready on FD
     }
     

tcp_select() is used to determine which file descriptor is ready for input. It returns 3 status values:


tcp_ERROR
the error message is printed using the system function perror(3).
tcp_TIMEOUT
the time interval specified in Timeout (seconds) expired.
tcp_SUCCESS
the FileDescriptor returned is ready to be read.

With Block == tcp_BLOCK, tcp_select() will ignore the Timeout parameter, and simply block until some data is available.

With Block == tcp_POLL, tcp_select() will sleep for Timeout seconds, or until data is available, whichever comes first.