Read and write string lines in socket.