You could save yourself the hard work of polling all the sockets manually and use POE. It handles all the IO multiplexing for you behind a high level event system using select/poll/epoll/whatever for the backend. It works especially well for network applications, and there are modules available to connect it to many common internet protocols.