Make sure all sockets are set NONBLOCK so that writes do not block.