sshnet / sshnet/SSH.NET

ErrorOccurred event different behaviour on Windows and Linux

Open
#881 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

I have a software with long running SSH connection and I have noticed a difference in behaviour when running it on Windows and Linux.
I am using sshClient.ErrorOccurred += delegate (object sender, ExceptionEventArgs e) {. . . } to detect connection errors.
With this, I expect the software should detect dropped connection (i.e. Internet down, cable unplugged etc.) as soon as it happens + SSH timeout. While this is working perfect on Windows, on Linux this event is being raised only on reconnection and not at disconnection time. Since the software will be deployed on Linux (RPI) I need this event to be raised at disconnection time - just like it does it on Windows.

My question is - why this difference in behaviour? And is there a way to get this event to be raised at the disconnection time on Linux?

Appreciate any help

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with a long-running SSH connection and reproduce the reported network-disconnection behavior on Windows and Linux, including the reconnect case. Trace the ErrorOccurred event path and compare when it is raised on both platforms. Done means the Linux behavior is understood and, if it is a bug, the event is raised at disconnection time rather than only on reconnection.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.