<p>Background: We are programmatically transferring files to an SFTP site that our company does not manage. Previously, we encountered an issue in which larger files would only partially upload to the site; this is not within the scope of this issue, but it will explain why we set our BufferSize property to 1024 * 8.</p>
<p> </p>
<p>Issue: Our file (723kb) uploads to the server successfully. However, we receive an SshException immediately afterward stating "Connection was lost". This is thrown before we can call our SftpClient.Disconnect() method; when we do call it, a second SocketException is thrown. "A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied".</p>
<p> </p>
<p>Notes:</p>
<p> - The log is attached as a .txt file.</p>
<p> - Server/Host name has been redacted for confidentiality purposes. We do not have administrative access to this server.</p>
<p> - I added a bit of extra logging. Namely, I show the value of the BufferSize property, and when SendMessage() is called, I add messageData.Length to the log.</p>
<p> - This uses the latest source code as of today.</p>
<p> </p>
<p>If you need more information please let me know.</p>
<p> </p>
<p>UPDATE 2012/10/01 - After doing more research, I noticed that we were sending a lot more messages than we were receiving from the server. I am led to believe this is due to their server being unable to handle the large packet sizes effectively. I modified my packet size to 1kb and have been able to successfully upload the larger files with only a negligible (if any) performance hit.</p>
Comments: ** Comment from web user: olegkap **
<p> </p>
<p>Issue: Our file (723kb) uploads to the server successfully. However, we receive an SshException immediately afterward stating "Connection was lost". This is thrown before we can call our SftpClient.Disconnect() method; when we do call it, a second SocketException is thrown. "A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied".</p>
<p> </p>
<p>Notes:</p>
<p> - The log is attached as a .txt file.</p>
<p> - Server/Host name has been redacted for confidentiality purposes. We do not have administrative access to this server.</p>
<p> - I added a bit of extra logging. Namely, I show the value of the BufferSize property, and when SendMessage() is called, I add messageData.Length to the log.</p>
<p> - This uses the latest source code as of today.</p>
<p> </p>
<p>If you need more information please let me know.</p>
<p> </p>
<p>UPDATE 2012/10/01 - After doing more research, I noticed that we were sending a lot more messages than we were receiving from the server. I am led to believe this is due to their server being unable to handle the large packet sizes effectively. I modified my packet size to 1kb and have been able to successfully upload the larger files with only a negligible (if any) performance hit.</p>
Comments: ** Comment from web user: olegkap **
Hi,
This is actually not an issue but it looks like server behaviour.
If you look at log file provided:
SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'DisconnectMessage': 'SSH_MSG_DISCONNECT'.
Which tells me that remote server disconnects client. This is probably due to security setting that they did, that after receiving a file, disconnect immediately.
Can you try to use other clients to transfer exactly the same information?
Cause I suspect this behavior will be consistent.
If not please let me know your findings.
I will close this issue for now.
Thanks,
Oleg