EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Problem connecting with SFTP

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
Posted: 12/18/2006 09:47:11
by George Shirai (Basic support level)
Joined: 12/18/2006
Posts: 7

I'm having problems connecting to an SFTP site with the SFTP demos in Visual Basic 6. I have been getting the following error when I run the program that uses the external socket:

Run-time error '40006':
Wrong protocol or connection state for the requested transaction or request

I am able to connect to the SFTP site using Core FTP, a stand-alone app. It seems to connect with SSH protocol version 2. I'm not sure why the SFTP demo program isn't connecting.

Here is the log I get from Core FTP:

WinSock 2.0
Mem -- 522,928 KB, Virt -- 2,097,024 KB
Started on Monday December 18, 2006 at 09:32:AM
Looking up host "******************"
Connecting to ***.***.***.*** port 22
Server version: SSH-2.0-Sun_SSH_1.0.1
version: SSH-2.0-SSH-Local: Mar 5 2006 23:44:38
Using SSH protocol version 2
processing key exchange
Host key fingerprint is:
ssh-rsa 1024 **********************************
Initialized AES-128 client->server encryption
Initialized AES-128 server->client encryption
Sent password
Access granted
Opened channel for session
Started shell session
Current directory is '/export/home/******/'
Keep alive off...
Transferred 175 bytes in 0.500 seconds

Any suggestions would be appreciated!
Posted: 12/18/2006 10:09:42
by Ken Ivanov (EldoS Corp.)

Would you be so kind to specify the SecureBlackbox build number you are using?
Posted: 12/18/2006 10:31:55
by George Shirai (Basic support level)
Joined: 12/18/2006
Posts: 7

It's 4.4.
Posted: 12/18/2006 11:05:02
by Ken Ivanov (EldoS Corp.)

Please try to install the latest available build update (5.0.103) and check if the issue appears with it. There were too many changes since 4.4, so the problem you are reporting might have been fixed.
Posted: 12/18/2006 11:51:18
by George Shirai (Basic support level)
Joined: 12/18/2006
Posts: 7

I just tried downloading the 5 beta (5.0.102) Active X version, and the same problem occurs.

Also, when this error is encountered, the program appears to lock up and I can't close it (or Visual Basic 6.0) without shutting it down from Windows task manager. When I close one, both are shut down...
Posted: 12/18/2006 11:54:40
by George Shirai (Basic support level)
Joined: 12/18/2006
Posts: 7

To clarify, I have downloaded and installed the 5.0 beta.

Also, while stepping through the code in debug mode, it seems to get hung up in the MessageLoop event. It will call the receive and send functions now and then, but the data is always empty, and it just goes back to MessageLoop again and again... As soon as I stop stepping through by clicking "Run", I see the same error as before.
Posted: 12/18/2006 12:01:49
by George Shirai (Basic support level)
Joined: 12/18/2006
Posts: 7

Sorry, my last message was incorrect. It goes through the MessageLoop event a few times before getting stuck in the OnError event. The messages received seem to be empty, but perhaps I need to double-check that. The messages being sent are not empty. While running in debug mode, it will output an error message to the log multiple times... Running it normally will only display the error once before the program hangs.
Posted: 12/18/2006 12:55:08
by Ken Ivanov (EldoS Corp.)

Would you be so kind to provide us the following information so that we could try to reproduce the issue here:
a) what exactly demo application are you using (we suppose it's the one located in SocketSimpleSftpDemo folder, isn't it?),
b) do other samples (such as SimpleSFTPDemo with built-in socket support) work,
c) what exactly error code/message are passed to the OnError event?
Posted: 12/18/2006 13:33:37
by George Shirai (Basic support level)
Joined: 12/18/2006
Posts: 7

a) Yes, that is correct. The above errors were in regards to the sample program in the SocketSimpleSftpDemo folder.
b) The program in the Demo folder does not work either. The log reads "TCP connection opened" but nothing seems to happen after that. With the program in the SimpleSftpDemo folder, the log simply reads "Error: Connection lost" immediately after attempting to connect.
c) With the program in the SocketSimpleSftpDemo folder, when in the sckClient_Error event, the error number is 10053. The description is "Connection is aborted due to timeout or other failure". This is what I see when I'm in debug mode. If I'm just running the application without breakpoints, I get this message from Visual Basic: "Run-time error '40006': Wrong protocol or connection state for the requestion transaction or request."
Posted: 12/18/2006 17:16:22
by Ken Ivanov (EldoS Corp.)

Run-time error '40006' is usually thrown if a read or write call was performed for a closed socket. It seems that SSH/SFTP connection fails to be established due to some protocol error, and this situation is not handled correctly by the demo application. *Why* that connection fails is another problem, which we start to investigate right now.
Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.



Topic viewed 16148 times

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


Back to top

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

Got it!