This project is read-only.

SshCommand fails on the second time

Sep 5, 2012 at 7:39 AM

Hi,

I am trying to run something like this (taken from the documentation)

  1. using (var client = new SshClient("host", "username", "password"))
    {
      client.Connect();
      var cmd = client.CreateCommand("date");
      cmd.Execute();
      Console.WriteLine(cmd.Result);
      cmd.Execute("ls -l");
       Console.WriteLine(cmd.Result);
      client.Disconnect();
    }

First execute goes well, second execute throws "An established connection was aborted by the software in your host machine.". 

Disconnecting and Connecting again solves the problem (but I hate doing so).

Running the same code while connecting to a different machine works perfectly.

Any ideas ?

Thanks

Roni