hemant
2/29/2008 4:50:00 AM
On Fri, Feb 29, 2008 at 6:23 AM, Nasir Khan <rubylearner@gmail.com> wrote:
> We can set socket options using setsockopt on BasicSocket, where can I get
> various constants SOL_ constants such as Socket::SOL_SOCKET etc?
> I am unable to find them in rdoc.
>
I am afraid, RDoc won't have an exhaustive list of these constants.
However, for all such purposes, I have Richard Stevens book on network
programming book and you can find them listed there.
> Also while writing a TCP client to a non Ruby (but non blocking) server
> while I write on the socket using socket.write <string> I am not getting
> anything on the server till I do socket.close.
> socket.puts <string> works fine but has an additional newline in the message
> which I do not want.
As for disabling naggle algorithm you can use:
t_sock_addr = Socket.sockaddr_in(port,ip)
t_socket.setsockopt(Socket::IPPROTO_TCP,Socket::TCP_NODELAY,1)
Also problem you mention shouldn't have anything to do with flush or
naggle algorithm.
Probably, your server is using newline as message separator in which
case. But this is just a wild guess.