Archived Forum Post

Index of archived forum posts

Question:

SFTP Connect Fails with: Failed to read initial server version string

May 27 '16 at 16:59

The initial connection to the SFTP server fails with this error:

...
        --connectSocket
        Established TCP/IP connection with SSH server
        Turning on TCP_NODELAY.
      --sshConnect
      sshSetupConnection(8000ms):
        clientIdentifier: SSH-2.0-PuTTY_Release_0.66
        Sending client identifier...
        Done sending client identifier.
        Reading server version...
        Failed to read initial server version string
        bytesReceived:
      --sshSetupConnection
    --connectInner
    Failed.
  --Connect_SFtp
--ChilkatLog


Answer

When an SSH/SFTP client connects to an SSH server, the first thing is to establish a TCP connection. That worked fine, as you can see "Established TCP/IP connection with SSH server".

Now the SSH client and server enter the SSH connection protocol, where information is exchanged and the secure channel is created. The very first thing that happens is that the server sends a server identifier string to the client, and the client sends a client identifier string to the server. Each side should send its identifier, and then read the TCP connection to receive the peer's identifier.

In the LastErrorText above, Chilkat has sent its identifier, but it is still waiting for the server's identifier to arrive. Nothing arrived within 8 seconds (8000ms) which is the value your app set for the IdleTimeoutMs property. Something external blocked the server's message -- either a firewall (software or hardware), or anti-virus, or the server never sent it.

The solution is external. It's not something that needs to be fixed within your app, nor is it something that needs to be fixed within Chilkat. It's something external blocking the communications, or the server is not responding for some reason..