0
我正在開發一個使用sftp在手機和服務器之間傳輸文件的Android應用程序。目前我使用jsch(0.1.45)和海綿堡。一切工作正常,除了Honeycomb(在ICS上正常工作),我已經嘗試了所有我能想到的。JSch on Honeycomb
連接和上市文件表現爲預期的,但是當我試圖改變遠程目錄或傳送文件,我得到以下異常:
01-01 20:42:40.270: E/SFTP(362): Caused by: java.io.IOException: inputstream is closed
01-01 20:42:40.270: E/SFTP(362): at com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2529)
01-01 20:42:40.270: E/SFTP(362): at com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2553)
01-01 20:42:40.270: E/SFTP(362): at com.jcraft.jsch.ChannelSftp._realpath(ChannelSftp.java:2010)
01-01 20:42:40.270: E/SFTP(362): at com.jcraft.jsch.ChannelSftp.cd(ChannelSftp.java:300)
如果我開始在調試模式下的SSH服務器,我得到:
debug2: fd 3 setting TCP_NODELAY
debug3: packet_set_tos: set IP_TOS 0x08
debug2: fd 11 setting O_NONBLOCK
debug2: fd 10 setting O_NONBLOCK
debug2: fd 13 setting O_NONBLOCK
debug2: channel 0: read 641 from efd 13
debug3: channel 0: discard efd
Bad packet length 920403810.
Disconnecting: Packet corrupt
Jsch記錄儀給我下面的:
01-01 20:46:12.301: D/LOG(362): Connecting to 192.168.2.100 port 22
01-01 20:46:12.371: D/LOG(362): Connection established
01-01 20:46:12.830: D/LOG(362): Remote version string: SSH-2.0-OpenSSH_5.8p1 Debian-7ubuntu1
01-01 20:46:12.830: D/LOG(362): Local version string: SSH-2.0-JSCH-0.1.45
01-01 20:46:12.830: D/LOG(362): CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
01-01 20:46:13.274: D/LOG(362): CheckKexes: diffie-hellman-group14-sha1
01-01 20:46:13.391: D/dalvikvm(362): GC_CONCURRENT freed 809K, 34% free 8829K/13319K, paused 6ms+7ms
01-01 20:46:14.164: D/LOG(362): SSH_MSG_KEXINIT sent
01-01 20:46:14.164: D/LOG(362): SSH_MSG_KEXINIT received
01-01 20:46:14.171: D/LOG(362): kex: server->client aes128-ctr hmac-md5 none
01-01 20:46:14.171: D/LOG(362): kex: client->server aes128-ctr hmac-md5 none
01-01 20:46:14.270: D/LOG(362): SSH_MSG_KEXDH_INIT sent
01-01 20:46:14.270: D/LOG(362): expecting SSH_MSG_KEXDH_REPLY
01-01 20:46:14.431: D/LOG(362): ssh_rsa_verify: signature true
01-01 20:46:14.441: D/LOG(362): Host '192.168.2.100' is known and mathces the RSA host key
01-01 20:46:14.441: D/LOG(362): SSH_MSG_NEWKEYS sent
01-01 20:46:14.441: D/LOG(362): SSH_MSG_NEWKEYS received
01-01 20:46:14.499: D/LOG(362): SSH_MSG_SERVICE_REQUEST sent
01-01 20:46:14.510: D/LOG(362): SSH_MSG_SERVICE_ACCEPT received
01-01 20:46:14.571: D/LOG(362): Authentications that can continue: publickey,keyboard-interactive,password
01-01 20:46:14.584: D/LOG(362): Next authentication method: publickey
01-01 20:46:14.591: D/LOG(362): Authentications that can continue: password
01-01 20:46:14.591: D/LOG(362): Next authentication method: password
01-01 20:46:14.711: D/LOG(362): Authentication succeeded (password).
01-01 20:46:18.512: D/LOG(362): Caught an exception, leaving main loop due to SSH_MSG_DISCONNECT: 2 Packet corrupt
01-01 20:46:18.512: D/LOG(362): Disconnecting from 192.168.2.100 port 22
有沒有人用jsch在蜂窩上正確工作?