0 votes
by (120 points)
edited

I am using the SSH terminal component to connect to a remote device. If the connection is active, and the device is subsequently turned off (not a clean shutdown), there is no indication that the connection has been lost (the Disconnected event is not fired). The Disconnected event is fired approximately 20 seconds after the user types in some characters in the terminal window. If the user does not type in any characters, nothing happens.

Is is possible to detect if the terminal connection is no longer valid? I would like to notify our users as soon as the connection is dropped.

1 Answer

0 votes
by (147k points)
edited

I'm afraid that when the device is turned off, the TCP connection used by the SSH session is not properly closed (or it's actually not closed at all) and the TCP/IP stack at the client machine is not even aware of this until the SSH component tries communicating with the device (which happens when some characters are typed).

To be able to detect this kind of unclean shutdowns, you would have to be somehow "pinging" the device continuously. But it would still take 20 seconds to detect this (it looks like it takes this long for the TCP/IP stack to realize the connection is broken). If you would still like to give this a try, please let us know at suppor@rebex.net.

Please be aware that I'm only guessing - a communication log produced using a network protocol analyzer such as Wireshark that can show the communication at the TCP level would be needed to confirm this.

...