From: Gary Wright Date: 2008-02-29T12:52:33+09:00 Subject: Re: how to set socket options? On Feb 28, 2008, at 7:53 PM, Nasir Khan wrote: > Also while writing a TCP client to a non Ruby (but non blocking) > server > while I write on the socket using socket.write I am not > getting > anything on the server till I do socket.close. > socket.puts works fine but has an additional newline in > the message > which I do not want. Try socket.flush. It seems like your socket is line buffered. I'm not sure how Ruby decides on buffering and there doesn't seem to be an interface to something like setvbuf. Perhaps someone else can provide some insight. One thing to keep in mind when using TCP is that message boundaries are not preserved. A write on one end of a TCP socket does not necessarily map to a corresponding read with the same data on the other end of the socket. Gary Wright