Encapsulates POSIX select call, allowing waiting on set of sockets for specified events.
Clears the set of socket to wait on.
void Add(SOCKET s, dword events = WAIT_ALL)
Adds socket s to the set to be waited on specified events. Note that SocketWaitEvent always waits for exceptions.
void Add(TcpSocket& s, dword events = WAIT_ALL)
Adds TcpSocket s to the list to be waited on specified events. If s is not open, it is not used but its index is reserved anyway (see Get).
int Wait(int timeout)
Waits for event for timeout ms. If timeout is Null, call is blocking. Returns a number of sockets that signaled an event.
dword Get(int i) const
dword operator(int i) const
Returns events that triggered for socket at index i (indicies are specified by order of Add calls) as binary or of WAIT_READ, WAIT_WRITE, WAIT_IS_EXCEPTION (something bad happened, like peer closing the connection). If there were none events for requested socket (or it is not open), returns 0.