Problems with poll()/write() on non-blocking sockets