0 votes
by (120 points)

I have started getting the following error while uploading file at ftp. I was working quite a few days before.

Rebex.Sftp - Runtime Version: v4.0.30319

Details:

Message: The server has closed the connection. Source: Rebex.Sftp
StackTrace: at Rebex.Net.Sftp.TL(IAsyncResult A, Sftp B, String C,
Enum[] D) at Rebex.Net.Sftp.OBB(IAsyncResult A, String B) at
Rebex.Legacy.SftpExtensions.EndPutFile(Sftp instance, IAsyncResult
asyncResult) at
gloPMClaimService.frmUploadClaim.SecureUploadCallback(IAsyncResult
asyncResult) TargetSite: System.Object TL(System.IAsyncResult,
Rebex.Net.Sftp, System.String, System.Enum[])
InnerException:

5/2/2017 7:03:58 AM:443 Message: The server has closed the connection.
Source: Rebex.Sftp StackTrace: at Rebex.Net.YEB.JC(Int32 A) at
Rebex.Net.YEB.IC(SDB& A) at Rebex.Net.YEB.IC(UInt32 A, Boolean B)
at Rebex.Net.YEB.PB(UInt32 A, BEB B) at Rebex.Net.Sftp.UAB(VFB A,
BEB B, String C, Stream D, Int64 E, Int64 H, WCB I) at
Rebex.Net.Sftp.UAB(VFB A, BEB B, String C, String D, Int64 E, Int64 H,
Int64 I, WCB J) at Rebex.Net.Sftp.AQ(Object A, Enum B, Object[] C)
at Rebex.UDB.Z(Object A) TargetSite: Void JC(Int32)

I am using the following method to upload file :

_secure_FTP.BeginPutFile(_localPath, _remotefilePath, new AsyncCallback(SecureUploadCallback), null);



public void SecureUploadCallback(IAsyncResult asyncResult)
        {
            try
            {
                _secure_FTP.EndPutFile(asyncResult);
                if (!IsDisposed)
                    Invoke(new TransferFinishedDelegate(SecureTransferFinished), new object[] { null, true });
            }
            catch (Exception ex)
            {
                if (!IsDisposed)
                    Invoke(new TransferFinishedDelegate(SecureTransferFinished), new object[] { ex, true });
            }
        }
Applies to: Rebex SFTP

1 Answer

0 votes
by (72.7k points)

For some reason, the server decided to close the connection. However, from exception only we cannot find the cause.

Can you please create communication log in Debug level as shown bellow and send it to support@rebex.net for analysis?

Sftp client = new Sftp();
client.Connect(...);
client.Login(...);
client.LogWriter = new Rebex.FileLogWriter("sftp.log", Rebex.LogLevel.Debug);
by (120 points)
The e-mail is sent for the request log
by (72.7k points)
Thank you for the log file. It seems that the queuing causes troubles. Please try to disable queuing by setting this:

client.Settings.DisableTransferQueue = true;

And let us know, whether this solved the issue.
by (120 points)
We have disable the queuing setting but still have the issue. I have sent the log via e-mail to support.
by (72.7k points)
Thank you for the log file. I have already replaied to it. I am copying my answer here, for other users.

I suggest you following steps:

1)    Try to adjust size of data packets to smaller value by setting:
client.Settings.UploadBufferSize = 4 * 1024;

or to greater value:
client.Settings.UploadBufferSize = 48 * 1024;

2)    Disable firewall and antivirus – sometimes this kind of software breaks existing connections.

3)    Update Rebex assemblies to the latest version.
From the log file I can see that client version is Sftp 3.0.5171.0, which was released at 2014-02-26.
The current version is 3.0.6291.0, which was released at 2017-03-22.

•    If you have active support contract, you can download current full version from https://www.rebex.net/protected/
•    If you don’t have active support contract, you can download current trial version from https://www.rebex.net/sftp.net/download.aspx

4)    Try to upload the same file using other client such as FileZilla or WinSCP or Bitvise SSH client.
If you are able to upload file successfully using other client, you should be able to upload using Rebex as well. In this case, please send us log from the other client so we can compare differences.

5)    Update server to the latest version.
From the log file I can see that the server version is 'SSH-2.0-Serv-U_10.4.0.0'.
On Vendors page is written: Serv-U 10.4.0.0 was released January 25, 2011.
The current version is: Serv-U 15.1.5 was released February 13, 2017.

Please keep queuing disabled (client.Settings.DisableTransferQueue = true), it seems it has small positive impact to the transfer.
by (120 points)
Could not find the said setting on current libraries: client.Settings.UploadBufferSize
by (58.9k points)
This property (client.Settings.UploadBufferSize) was added recently and you will need to update to the new version of Rebex components, to be able to use it. If you already have a license, just login to www.rebex.net/protected. Or just try our free 30-day trial from http://www.rebex.net/sftp.net/download.aspx
...