From: "Iñaki Baz Castillo" Date: 2011-03-17T20:06:54+09:00 Subject: Re: TCPSocket: how to realize that the other endpoint has closed the connection? 2011/3/17 Robert Klemme : > On Thu, Mar 17, 2011 at 3:38 AM, 7stud -- wrote: >> It's possible that your first send() is stuck in a buffer.  See if >> calling flush() on the socket works. > > Determining whether a network connection is still live is generally a > pretty complex thing. Using EventMachine (to connect to a TCP server) the #unbind method is inmediately called when the endpoint closes the connection. > Usually the most reliable way to find out the > status of a connection is to use it.  IIRC there are some socket > options that can influence shutdown behavior and timing.  See for > example here for general description of socket options > http://linux.die.net/man/7/socket > > and how to apply them > http://www.ruby-doc.org/stdlib/libdoc/socket/rdoc/classes/BasicSocket.html#M003703 Ok, I'll check such socket options. Thanks a lot. -- Iñaki Baz Castillo