writing to socket