SSH/SFTP Error: Must first connect to the SSH server
The following error is explained in this post:
ChilkatLog:
DownloadFileByName:
DllDate: Apr 25 2018
ChilkatVersion: 9.5.0.73
UnlockPrefix: *
Architecture: Little Endian; 64-bit
Language: Cocoa Objective-C
VerboseLogging: 0
SftpVersion: 3
Component successfully unlocked using purchased unlock code.
Must first connect to the SSH server.
--DownloadFileByName
--ChilkatLog
The above error can happen after a long period of inactivity. Let’s say your application successfully connected and authenticated w/ the SFTP server, did some things, and then did not do anything else for a long period of time. Meanwhile, the SFTP server decides to disconnect because the client has been inactive for too long. The client (your app + Chilkat) would only discover that the server has dropped the connection once it tries to do something, such as in a call to DownloadFileByName. The non-connected socket is discovered in the 1st attempt to send a message, and thus you receive the above error.
There are two possible actions an application might take:
- Prevent the disconnect by periodically calling sftp.SendIgnore to keep the connection from being inactive.
- (auto-recovery) If DownloadFileByName (or some other method) returns false/0 to indicate failure, examine the sftp.IsConnected property. If not connected, then automatically re-connect, re-authenticate, and call InitializeSftp to get back to a connected state, and then retry the method.
admin
0
Tags :