Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Commented Unassigned: An established connection was aborted by the server [2398]

$
0
0
When trying to download files from sftp, I am getting error:"__An established connection was aborted by the server__"
Comments: ** Comment from web user: jmf **

Certainly. Thank you for taking a look at the issue!

As I mentioned, this works great for smaller files. It's only when I attempt to read a 1.4MB file that I get an error saying the established connection was aborted by the server. I tried reading smaller chunks of the file inside of a loop, but the first attempt to read the file is met with the same error. At this point, I'm not sure if it's a code problem on my end or some type of limitation on the server I'm connecting to. Unfortunately, the server belongs to a 3rd party and I don't have any access or information beyond what I use to connect.

Thanks in advance for any advice or suggestions you have. I'm certainly no expert in SSH. In fact, this is my first time to use SSH in an app. Thank for providing this library. I can see that it was no small feat!

```
var sftp = new SftpClient(new PasswordConnectionInfo(ftpServer, 22, ftpLogin, ftpPassword));
sftp.Connect();
sftp.ChangeDirectory(ftpDirectory);

if (sftp.Exists(fileName))
{
var file = sftp.OpenRead(ftpDirectory + '/' + fileName);

if (file.Length > 0 && file.CanRead)
{
byte[] buffer = new byte[file.Length];
int eof = (int) file.Length;
file.Read(buffer, 0, eof); // *** error occurs here ***
}
file.Dispose();
}

if (sftp.IsConnected) {sftp.Disconnect();}
sftp.Dispose();

```


Viewing all articles
Browse latest Browse all 1026

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>