SCP:Download - An established connection was aborted by the software in your host machine

Jun 4, 2012 at 2:05 PM

I`m downloading files from external machine. Sometimes those files are downloaded ok, but sometimes exception occurs with message "An established connection was aborted by the software in your host machine".

I`m using Renci.SshNet.ScpClient and there is about 400 files to be retrieved. I can`t download whole directory at remote machine, because there is lot of other stuff too.


for (int file = 0; file < files; file++)
     string fileToBeRetrieved = filenames[file];

     string remoteFile = remotePath + "/" + fileToBeRetrieved;
     string localFile = System.IO.Path.Combine(localPath, fileToBeRetrieved);

     sshCp.Download(remoteFile, new FileInfo(localFile)); // sometimes CRASH


This might be problem with that device also, but if not should I used some connection/command timeout values or could there be a bug releated to this at SSH.NET?

I could load more than one file with SCP at once, but that`s not probably the solution for this.

Jun 5, 2012 at 8:19 PM



The reason you getting this error is because server for some reason dropped the connection.

If you have a debug access to server, you can run ssh in debug mode and then if connection drops again you can see why,

At least it usually tells why.

It could be a problem with the library but I assume could be some connection problems as well.


If you get a debug info as far as why it drops, can you send it to me, publicly or privately so I could take a look and fix it if I can?