You seem to have misunderstood the functionality of select. Select
does not wait for the time interval specified. It checks the status of the specified sockets, that is whether the socket has data ready to be read (sockets in readfds), or socket is ready to be written (sockets in writefds) or have errors (exceptfds).
The timeout specifies the
maximum time for the status to change.
A sample usage of select is to check if there is data to be read from socket to ensure that read does not block:
twait.tv_sec = 0;
twait.tv_usec = THIRTY_MILLISECONDS
count = select (0, readfds, NULL,NULL, &twait);
if( count == 0 ) {
// select failed after waiting for THIRTY_MILLLISECONDS
} else {
// We have data ready to be read
}
If you want to wait for THIRTY_MILLLISECONDS for whatever reason, use
Sleep(THIRTY_MILLLISECONDS)
Regards