Skip to content

RunCommand hangs when run agains a cisco SX20 #307

Description

@greysun75

I am trying to use SSH.Net to run a command on a cisco SX20. I am able to connect to the endpoint but when it hits the RunCommand line the app freezes. I am able to use PuTTy to run the same command without issue. Any idea where I might be going wrong?

I have been at this for days trying different variations of code but they all seem to hang at the same place, either on RunCommand or .Execute. Here is what I currently have

`private void btnCheck_Click(object sender, EventArgs e)
{
var pass = Encoding.ASCII.GetBytes("mypassword");

 KeyboardInteractiveAuthenticationMethod kauth = new KeyboardInteractiveAuthenticationMethod("myuser");
kauth.AuthenticationPrompt += new EventHandler<Renci.SshNet.Common.AuthenticationPromptEventArgs>(HandleKeyEvent);
ConnectionInfo conInfo = new ConnectionInfo("myip", 22, "myuser", kauth);
using (var client = new SshClient(conInfo))
{
try
{
client.Connect();
if (client.IsConnected)
{
SshCommand sshCommand = client.RunCommand("xStatus SystemUnit Uptime");
lblUptime.Text = sshCommand.Result;
client.Disconnect();
}
}
catch (Exception error)
{
string Error = error.Message.ToString();
}
}
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions