I'm very new to the SCP protocol and JSch. I have to transfer a file fro a remote device via SCP to Android. The server side developers refused to tell be anything about their device except for the file location, and the root account which can be used to access it with SCP.
Here are the steps I tried.
Confirm that using JSch, my Android client can establish connection with the server. [complete]
Confirm that using JSch, and the ChannelExec
object, I can send the ls
command and read its output. [complete]
Confirm that using JSch, and the ChannelSFTP
object, I can transfer a file from the device. [failed]
The reason why (3) failed seems that the device (server) is not configured for SFTP. The maker keeps on saying that commands on ssh like below works:
scp root@192.168.5.1/usr/WS026.jpeg [targetPath]
They say that the above command will copy the first parameter to the target path of the client. So, alternative to using the SFTP, how can I implement that in JSch channel "exec"?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…