sharpssh “session is down” during co...

Help
Anonymous
2012-11-23
2013-05-28

  • Anonymous
    2012-11-23

    See http://stackoverflow.com/questions/13513893/sharpssh-session-is-down-during-concurrent-connections

    I'm integrating SharpSSH in on existing .NET 2.0 project. So can't switch to http://sshnet.codeplex.com/ or other newer library…

    I have everything working for a single connection with a device and can run commands and upload files without problems.

    But because this tool has to be able to update multiple devices at the same time the application starts multiple sharpssh connections at the same time. Then everything keeps on working but sometimes a file isn't uploaded completely and the error "session is down" is thrown.

    SshTransferProtocolBase tx = new Scp(_hostname, _username, _password);
    tx.Connect();
    tx.OnTransferProgress += new FileTransferEvent(tx_OnTransferProgress);

    tx.Put(sshSource.FullName, "/tmp/" + Path.GetFileName(sshTarget));
    // -> tx.Put throws the error
    When replacing "new Scp" with "new Sftp" like this

    SshTransferProtocolBase tx = new Sftp(_hostname, _username, _password);
    The error message is: "inputstream is closed" or "session is down"

    Any ideas on how to avoid this?

    Thanks a lot, Frank