Default constructor
Destructor
This function keeps a weak reference to the socket, so you have to make sure that the socket is not destroyed while it is stored in the selector. This function does nothing if the socket is not valid.
Add a new TcpSocket to the selector.
Add a new UdpSocket to the selector.
Remove all the sockets stored in the selector.
Test a socket to know if it is ready to receive data.
Test a socket to know if it is ready to receive data.
Test a socket to know if it is ready to receive data.
Remove a socket from the selector.
Wait until one or more sockets are ready to receive.
Multiplexer that allows to read from multiple sockets.
Socket selectors provide a way to wait until some data is available on a set of sockets, instead of just one.
This is convenient when you have multiple sockets that may possibly receive data, but you don't know which one will be ready first. In particular, it avoids to use a thread for each socket; with selectors, a single thread can handle all the sockets.