我正在评估Chilkat SFTP的新图书馆。
但是,在连接到SFTP时,我得到了如下错误:
ChilkatLog:
Connect_SFtp:
DllDate: Aug 15 2013 ChilkatVersion: 9.4.1.42 UnlockPrefix: xxxxxxxx Username: (hidden) Architecture: Little Endian; 32-bit Language: .NET 2.0 VerboseLogging: 0 SftpVersion: 0 hostname: xx.xxx.xxx.xxx port: 22 ConnectTimeoutMs\_1: 50000 calling ConnectSocket2 IPV6 enabled connect with NO heartbeat. This is an IPV4 numeric address... AddrInfoList: AddrInfo: ai\_flags: 4 ai\_family: 2 ai\_socktype: 1 ai\_protocol: 0 ai\_addrlen: 16 ai\_canonname: (NULL) --AddrInfo --AddrInfoList Connect using IPV4. ipAddress1: xx.xxx.xxx.xxx myIP\_3: xx.x.xxx.xx myPort\_3: 50483 connect successful (2) Established TCP/IP connection with SSH server Turning on TCP\_NODELAY. clientIdentifier: SSH-2.0-PuTTY\_Local:\_May\_11\_2009\_17:22:38 Sending client identifier... Done sending client identifier. Reading server version... initialDataFromSshServer: SSH-2.0-0.0 serverVersion: SSH-2.0-0.0
KeyExchangeAlgs:
algorithm: diffie-hellman-group1-sha1
algorithm: diffie-hellman-group-exchange-sha1
algorithm: diffie-hellman-group14-sha1
--KeyExchangeAlgs
HostKeyAlgs:
algorithm: ssh-dss
--HostKeyAlgs
EncCS:
algorithm: aes256-cbc
algorithm: aes192-cbc
algorithm: aes128-cbc
algorithm: twofish-cbc
algorithm: blowfish-cbc
algorithm: 3des-cbc
algorithm: arcfour
--EncCS
EncSC:
algorithm: aes256-cbc
algorithm: aes192-cbc
algorithm: aes128-cbc
algorithm: twofish-cbc
algorithm: blowfish-cbc
algorithm: 3des-cbc
algorithm: arcfour
--EncSC
MacCS:
algorithm: hmac-sha1
algorithm: hmac-sha1-96
algorithm: hmac-md5
algorithm: hmac-md5-96
--MacCS
MacSC:
algorithm: hmac-sha1
algorithm: hmac-sha1-96
algorithm: hmac-md5
algorithm: hmac-md5-96
--MacSC
CompCS:
algorithm: zlib
algorithm: none
--CompCS
CompSC:
algorithm: zlib
algorithm: none
--CompSC
Encryption: 256-bit AES CBC
Encryption: 256-bit AES CBC
MAC: HMAC-SHA1
MAC: HMAC-SHA1
Compression: zlib
Compression: zlib
Key Exchange: DH Group Exchange SHA1
Host Key Algorithm: DSS
numBits: 160
pbits: 2048
Using GEX Group.
Sending KEX_DH_GEX_REQUEST...
pbits: 2048
Unexpected message received. Expected KEX_DH_GEX_GROUP/KEXDH_REPLY.
msgType: 1
Failed.-Connect_SFtp --ChilkatLog
我主要是使用这4个函数连接到SFTP。
sftp.UnlockComponent(ChilkatKey);
sftp.Connect(hostname, port);
sftp.AuthenticatePw(username, password);
sftp.InitializeSftp(); 我错过了什么?谢谢你的帮助。
发布于 2013-10-18 15:58:25
正确的顺序应该和你的一样:
但是在这些人之后,您需要调用OpenDir和ReadDir(如果您需要获取文件,可以依赖远程文件夹),比如;
string handler = sftp.OpenDir("remote_path");
SFtpDir compassDir = sftp.ReadDir(handler);要下载一个不需要调用ReadDir但必须调用OpenDir的文件。在填充compassDir对象之后,您可以通过以下方法获得文件计数;
int fileAmount = compassDir.NumFilesAndDirs或者你可以下载文件的名字如下;
sftp.DownloadFileByName("local_path","Remote_path_with_file_name");很抱歉出错了……
https://stackoverflow.com/questions/18737838
复制相似问题