SSH.NET icon indicating copy to clipboard operation
SSH.NET copied to clipboard

DownloadFile - channel was closed exception

Open imapangolin opened this issue 5 years ago • 3 comments

I am at a loss of what to do to try to resolve this.

I do this first:

bool exist = m_client.Exists(ServerFileName);

And it comes back true - so I know my connection is established properly and the file does exist.

However, when I do this:

            m_client.DownloadFile(ServerFileName, file1);

I get the "Channel was closed" exception.

I can share credentials and server info if you need it in a private email.

Just reply and let me know where to send the info. It may be specific to this SFTP server and this code works for other servers just fine.

imapangolin avatar Sep 26 '21 21:09 imapangolin

Is this a duplicate of #868? I so, please close the other issue. Exchanging credentials like this is tricky business for both parties and I don't think anybody will "bite". What you could do is capture a network flow (using Wireshark would be one option) between your client and the server during your test and try to see if anything obvious is happening, like the connection always closing after specific amount of data exchanged, server closing the connection after some specific time etc. One specific thing you could try is lower MTU on you network adapter to 576 to see if Path MTU detection is at fault here. (Don't forget to raise it afterwards, this is WAY too low for real life usage!)

IgorMilavec avatar Oct 04 '21 19:10 IgorMilavec

Closing due to author's inactivity.

IgorMilavec avatar Mar 18 '22 15:03 IgorMilavec

Damn. I’m sorry. It’s resolved. But only by doing a file listing first. Then it works. No idea why.

On Mar 18, 2022, at 11:08 AM, Igor Milavec @.***> wrote:

 Closing due to author's inactivity.

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.

imapangolin avatar Mar 18 '22 15:03 imapangolin