Now we wait also until a socket is ready for writing, as well as reading.