Fixed to wait socket write only if no one byte sent.