I'm trying to connect to a server via SFTP using the JSch library.
I can connect successfully using FileZilla, but I'm unable to connect through my application.
From the logs, I got this error:
com.jcraft.jsch.JSchException: Session.connect: java.io.IOException: End of IO Stream Read
Any idea what might be causing this?
Is there, maybe, an example? (SFTP, JSch library) ?
I am not sure what I can tell you. I wrote a library that uses SFTP, and I had forgotten that I used JSch. I hit a couple of snags but got some help from the forum. Here is my setting up code . . .
B4X:
Public Sub Initialize(appDir As String, module As Object, eventHandler As String)
hostPath = hostFolder & appDir & "/" ' Full path at host
info.caller = module
info.handler = eventHandler
info.appFolder = appDir
hostFiles.Initialize
jobs.Initialize
sftp.Initialize("sftp", "username", "password", "sftp.provider.com", 22)
makeList
End Sub
' This routine automatically authenticates the RSA fingerprint check
Private Sub SFTP_PromptYesNo (Message As String)
sftp.SetPromptResult(True)
End Sub
After that the coding is straightforward upload/download tasks. I have never seen your error message so cannot give you any pointers there, but I can confirm that the JSch library does work. Let me know if I can be of more help.