EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Connection Lost (error code is 10054)

Posted: 09/15/2008 19:23:13
by Mark Belfer (Standard support level)
Joined: 09/15/2008
Posts: 8


I am building a SecureBlackbox application that downloads files from an SFTP site. It works well on most servers, but I must now install it on an environment where it does not. Unfortunately, the servers in question are hosted by a hosting company and I don't have much control over them. The problem is that I get "Connection lost" when attempting to connect to the SFTP site from any of these servers. When using version of the SecureBlackbox DLL's, "error code is 10054" is also appended to the message. I get this error on every SFTP site I try to access from the afflicted servers (even on the site up by the hosting company).

This environment is not the only environment that I am having this issue with. Of the 17 locations that I support, two others have the same issue. Fortunately, these other two clients do not need SFTP applications yet.

I am using both SecureBlackbox versions and (with the same results). The operating system of the target machine is Windows Server 2003, Standard Edition (Service Pack 2). My C# application is compiled with Microsoft Visual C# 2005 77626-009-0000007-41056.

The problem is complicated by the fact that Telnet, FileZilla, and SecureFX all work just fine. Because of this, I'm not getting much help from the hosting company. I am certain that there must be something in the environment of these servers that is proving toxic to SecureBlackbox (and SecureBlackbox only). My goal is to find some SecureBlackbox setting / property / method (or combination of settings) that will allow SecureBlackbox to work in this environment.

To help get to the bottom of this, I've written a simple program that exercises my ability to connect to an SFTP site (using my evaluation copy of version

The source code looks like this:
TElSimpleSFTPClient SftpClient = new TElSimpleSFTPClient();
<Assign all of the event handlers -- omitted for brevity>
SftpClient.Address = txtHostURL.Text;
SftpClient.Port = 22;
SftpClient.Username = txtUserID.Text;
SftpClient.Password = txtPassword.Text;
SftpClient.Open(); // This throws a "Connection Lost error code is 10054" exception.
To help trace what is going on, I implemented ALL of the event handlers. From a working server, the following is traced:
*** In the SftpClient_OnKeyValidate routine.
*** In the SftpClient_OnKeyValidate routine.
*** In the SftpClient_OnAuthenticationStart routine.
*** In the SftpClient_OnAuthenticationAttempt routine.
*** In the SftpClient_OnAuthenticationSuccess routine.
All of these event-handlers fire during the "SftpClient.Open();" line. From one of the servers that does NOT work, no event handlers are fired. The connection is lost even before the first "OnKeyValidate" event fires.

I hope to find a property in the TElSimpleSFTPClient class that I can set to make this work. Does anyone have any suggestions? Is there anything I can ask of the network group of the hosting company?

Thanks very much in advance for your assistance. Please let me know if I can provide any additional info.

Mark Belfer

Posted: 09/16/2008 07:12:22
by Ken Ivanov (Team)

Thank you for contacting us.

First of all, please follow the steps explained in the article. Some servers behave in unpredictable way if they encounter unknown algorithms in the list proposed by the client. The article shows how to bypass such an issue.
Posted: 09/16/2008 10:59:10
by Mark Belfer (Standard support level)
Joined: 09/15/2008
Posts: 8

Hi Innokentiy,

It worked!

I added the following line:
SftpClient.set_CompressionAlgorithms(0, false);

I'm now able to connect in both environments.

Thank you very much for your quick response!
Posted: 09/16/2008 11:07:22
by Ken Ivanov (Team)

Great, thank you for letting us know.
Posted: 12/27/2012 10:40:33
by Scott Hall (Basic support level)
Joined: 12/27/2012
Posts: 3

I have ran into the same issue. I have tried set_CompressionAlgorithms, as well as, other reccomendations that are in the referenced article, but have not had any success. When trying to open the connection, I can view the ftp server, and see that the session is active, but it never seems to authenticate.
Posted: 12/27/2012 12:21:26
by Ken Ivanov (Team)


First of all, could you please clarify what exactly do you mean by saying 'the same issue'? Is the Connection Closed exception thrown for you? Is OnError event invoked prior to the exception?

It would also be great if you provide us a bit more details on how exactly you can 'view' the FTP server. Authentication is performed at the very start of the session, so you can't see any files or folders until the session has been authenticated.
Posted: 12/27/2012 12:28:44
by Scott Hall (Basic support level)
Joined: 12/27/2012
Posts: 3

I apologize for not being more clear. Here is the code.

using (TElSimpleSFTPClient SftpClient = new TElSimpleSFTPClient())
SftpClient.OnAuthenticationSuccess += new TNotifyEvent(SftpClient_OnAuthenticationSuccess);
SftpClient.OnAuthenticationKeyboard += new TSSHAuthenticationKeyboardEvent(SftpClient_OnAuthenticationKeyboard);
SftpClient.OnCloseConnection += new TSSHCloseConnectionEvent(SftpClient_OnCloseConnection);
SftpClient.MessageLoop += new TSBSftpMessageLoopEvent(SftpClient_MessageLoop);
SftpClient.OnProgress += new TSBProgressEvent(SftpClient_OnProgress);
SftpClient.OnKeyValidate += new SBSSHCommon.TSSHKeyValidateEvent(this.SftpClient_OnKeyValidate);
SftpClient.OnAuthenticationFailed += new SBSSHCommon.TSSHAuthenticationFailedEvent(this.SftpClient_OnAuthenticationFailed);
SftpClient.OnError += new SBSSHCommon.TSSHErrorEvent(this.SftpClient_OnError);
SftpClient.OnAuthenticationAttempt += new TSSHAuthenticationAttemptEvent(this.SftpClient_OnAuthenticationAttempt);
SftpClient.OnAuthenticationStart += new TSSHAuthenticationStartEvent(SftpClient_OnAuthenticationStart);

SftpClient.set_CompressionAlgorithms(0, false);

SftpClient.Port = 21;
SftpClient.Address = "Address";
SftpClient.Username = "User";
SftpClient.Password = "pwd";
SftpClient.AuthenticationTypes = SBSSHConstants.Unit.SSH_AUTH_TYPE_PASSWORD;

//open connection

After the .Open method is called, no events fire except SftpClient_MessageLoop. After a few seconds I get the connection closed error thrown from .Open. I can access the ftp site fine from Internet Explorer, but not throug the TElSimpleSFTPClient.
Posted: 12/27/2012 12:31:27
by Vsevolod Ievgiienko (Team)


TElSimpleSFTPClient works via SFTP protocol, but not FTP. You should use TElSimpleFTPSClient instead.
Posted: 12/27/2012 12:35:56
by Scott Hall (Basic support level)
Joined: 12/27/2012
Posts: 3

Thank you very much



Topic viewed 7682 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!