Skip to content

Disposing a ShellStream instance shouldn't disconnect the SshClient instance which created it #459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ahelwer opened this issue Aug 14, 2018 · 5 comments
Milestone

Comments

@ahelwer
Copy link

ahelwer commented Aug 14, 2018

using (SshClient ssh = new SshClient(address, username, password) {
    ssh.Connect()
    using (ShellStream shell = ssh.CreateShellStream("xterm", 80, 80, 80, 80, 1024)) {
        // Do stuff
    }

    // I expect to be able to use the SshClient instance here but in fact it is disconnected
}
@keithallenjackson
Copy link

@ahelwer Looking at ShellStream.Dispose, there is no code that actually calls a disconnect. Are you sure it is not the end-device closing the connection? ShellStream creates a Channel that sends the ShellStream data back and forth. During the ShellStream Dispose, the Channel is closed (not the full SshClient).

@ahelwer
Copy link
Author

ahelwer commented Oct 1, 2018

@keithallenjackson you are correct, this only happens on some devices and not others. For example, I can confirm it occurs on the Cisco 4431 router running IOS-XE v16, but not the Cisco Nexus 3064 running NXOS v6.

@ahelwer
Copy link
Author

ahelwer commented Oct 1, 2018

Actually, it's even worse - I have to reconnect the SshClient instance after every single command execution (or shell instance closure) on the Cisco 4431!

@WojciechNagorski
Copy link
Collaborator

It's done in #1274

@WojciechNagorski WojciechNagorski added this to the 2023.0.1 milestone Dec 21, 2023
@WojciechNagorski
Copy link
Collaborator

The 2023.0.1 version has been released to Nuget: https://www.nuget.org/packages/SSH.NET/2023.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants