On Sat, Aug 03 2013, Lars Magne Ingebrigtsen wrote: > Is there any general way to determine if a connection is "stuck"? If > we've created a network connection, and we change IP addresses, then the > connection is AWOL and will never get any response to traffic. > > Hm... > > If there's no way to determine the AWOL-ness of a connection (and I > guess there isn't), but we can see that the IP address has changed, then > we should close the connection and start a new one. > > That might help. But how do we determine that the IP address has > changed? > > The IP address of the host itself may also not change, but the router's > address changes, in which case we won't find that out, but it's a start, > perhaps... > > A TCP level solution would be nice... Having a configurable receive timeout may be enough. If you are not receiving any byte in say 10 or 15 seconds, it's probably better to reconnect. If I'm not mistaken, creating socket with a SO_RCVTIMEO option would help to achieve that. -- Julien Danjou -- Free Software hacker - freelance consultant -- http://julien.danjou.info