Sockets: poll instead of select

The select function is very old and has limitations regarding the
number of the socket descriptor. The poll function is more modern
and robust, and is recommended instead of select.