We recently upgraded rebex libraries from 2012R2 to latest version, and changed the code to use Rebex.Net.FileTransferClient for both ftp and sftp, instead of Rebex.Net.Ftp and Rebex.Net.Sftp.
Getting remote file stream via sftp using method GetDownloadStream(FullFilePath) worked for all of ours production connections, except for one.
If I acquire the stream using the method GetFile(FullFilePath, remoteFileStream), then it works.
So the issue is fixed, but I would like to get to the root cause, and understend why is it throwing an exception on GetDownloadStream.
What is the difference between getting the stream with GetDownloadStream vs GetFile?
Is it something wrong with the way I use the method, a bug in rebex library, or some configuration on client's sftp server?
The way I'm calling it is straight forward:
using (Stream sourceStream = client.GetDownloadStream(fullFilePath))
Here is some log if that helps:
2016-05-18 22:54:41.352 INFO Sftp(2) Command: SSHFXPSTAT (9, '/')
2016-05-18 22:54:41.445 INFO Sftp(2) Response: SSHFXPATTRS (9)
2016-05-18 22:54:41.461 INFO Sftp(2) Command: SSHFXPOPEN (10, '/folder/fileName.txt', 1)
2016-05-18 22:54:41.554 INFO Sftp(2) Response: SSHFXPHANDLE (10, 0x64623832666562362D303830312D343561652D613735342D633839326239613337626235)
2016-05-18 22:54:41.554 DEBUG Sftp(2) Command: SSHFXPREAD (11, 0x64623832666562362D303830312D343561652D613735342D633839326239613337626235, 0, 65536)
2016-05-18 22:54:41.711 DEBUG Sftp(2) SSH: SSH connection closed.
2016-05-18 22:54:41.726 ERROR Sftp(2) SSH: Rebex.Net.SshException: The connection was closed by the server.
2 Z, Int32 D, VNX J, D C, Z I, Z W)
at Rebex.Net.SshSession.HPY[Z,D](UNX2 Z, D D)
at Rebex.Net.SshChannel.YD[Z,D](UNX`2 Z, D D)
at Rebex.Net.SshChannel.Receive(Byte buffer, Int32 offset, Int32 count)
2016-05-18 22:54:41.726 ERROR Sftp(2) SSH: Rebex.Net.SshException: The channel has been closed.
at Rebex.Net.SshChannel.Send(Byte buffer, Int32 offset, Int32 count)