This function determines the I/O status of the sockets specified in the various mask arguments. It returns when a socket is ready to be read or written, when the timeout period expires, or when exceptions occur. If timeout is a non-null pointer, it specifies a maximum interval to wait for the selection to complete. If the timeout argument is null, the select() function blocks indefinitely until a selected event occurs. To effect a poll, the value for timeout should be non-null, and should point to a zero-value structure. If a process is blocked on a select() function while waiting for input for a socket and the sending process closes the socket, then the select() function notes this as an event and unblocks the process. The descriptors are always modified on return if the select() function returns because of the timeout. NOTE When the socket option SO_OOBINLINE is set on the device socket, the select() function on both read and exception events returns the socket mask that is set on both the read and the exception mask. Otherwise, only the exception mask is set. Related Functions See also accept(), connect(), read(), recv(), recvfrom(), recvmsg(), send(), sendmsg(), sendto(), and write().