We have a client application which uses Rebex to host a long-running SSH tunnel. We need to be able to respond to fatal tunnel errors so that we can alert the user of the need to reconnect (for example, if there's a networking failure).
We have hooked into the TunnelError
event on the Ssh
object. However, not all events are for fatal errors. For example, I can cancel a command using the tunnel, which results in a SocketException "An existing connection was forcibly closed by the remote host". But this does not break the tunnel.
Is there an easy way to distinguish between errors that break the tunnel and those which are transient? Do you suggest we check the IsConnected
property or CheckConnectionState()
method after each error?
Update: I created a condition where, after establishing the tunnel, I broke network connectivity to the SSH server. However, even though the client can no longer connect to the SSH server, the CheckConnectionState()
and GetConnectionState()
methods and the IsConnected
properties all report that the connection is fine. Is this expected? I had hoped to use these methods to determine whether I had lost connection.