sharpssh"会话向下QUOT;在并发连接 [英] sharpssh "session is down" during concurrent connections

查看:308
本文介绍了sharpssh"会话向下QUOT;在并发连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在现有的.NET 2.0的项目整合SharpSSH。所以,不能切换到 http://sshnet.codeplex.com/ 或其他较新的库...

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.

但由于该工具具有能够在应用程序启动的同时多次sharpssh连接同时更新多个设备。然后,一切都坚持工作,但有时文件没有完全上传和错误会话下被抛出。

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

在使用新SFTP像这样<替换新SCP/ p>

When replacing "new Scp" with "new Sftp" like this

SshTransferProtocolBase tx = new Sftp(_hostname, _username, _password);



该错误信息是:为InputStream已关闭或会议已关闭

The error message is: "inputstream is closed" or "session is down"

如何避免这种情况?

非常感谢,
弗兰克

Thanks a lot, Frank

推荐答案

通过添加一个重试循环使用的重试可定义的最大数量解决...

solved by adding a retry loop with a definable maximum number of retries...

这篇关于sharpssh&QUOT;会话向下QUOT;在并发连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆