From: Nasir Khan Date: 2008-02-29T13:12:48+09:00 Subject: Re: how to set socket options? ------=_Part_10255_28808391.1204258374186 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I tried socket.flush it doesnt work either. The reason I asked for socketopt options is I wanted to try enabling TCP_NODELAY. On Thu, Feb 28, 2008 at 10:52 PM, Gary Wright wrote: > > 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 > > ------=_Part_10255_28808391.1204258374186--