Implement the writing on the socket