Using select now

Uses select on all sockets, handles disconnects more correctly.