in reply to Detecting disconnection from client using IO::Socket Objects.
TCP by default doesn't provide a mechanism for checking whether a system has gone away. The only way to know is if you try to send data to the system and you never get an acknowledgement.
The traditional way to fix this is using timeouts and/or some kind of NOOP command that either side can send to probe if the other side is down without affecting the state of the connection.
You could also try the SO_KEEPALIVE socket option, which trys to automate this at the TCP level. It's not very flexible, though, and has very long timeouts.
|
|---|