I use the sftp/JSCH library (see https://www.b4x.com/android/forum/threads/android-sftp-based-on-jsch-tutorial.26994/#content) to exchange files of several MB with a sftp server.
I have no authentication problems, and the transfer normally starts after a call to sftp.downloadfile.
The problem occurs during data reception. Sometimes the file loads completely, but very often it freezes during the download without any error, event or timeout. I use the events sftp_DownloadCompleted, sftp_ShowMessage, sftp_DownloadProgress)
The time of freezing is never the same, sometimes at the beginning, sometimes further away. Sometimes the freeze also occurs for 5 or 10 or 20 seconds and it continues for a few hundred additional bytes before locking again.
During a freeze, if I restart the transfer without leaving the application sometimes it happens, sometimes it freezes in another place.
The server I'm exchanging with has no problem, for example during a freeze if I use on the same android phone an transfer application managing the sftp ( AndFTP) to load my file it goes well and moreover with a higher speed than my Android application. Similarly, a Filezilla from a Windows PC works without any problems.
I have of course tried application both in Debug mode, and in release mode, on several phones and versions of Android, and also by putting my code either in an activity or in a service, etc... but the problem occurs exactly the same way.
Are there any "hidden" parameters in JSCH that would allow you to unlock or find out more, where is there another library that manages the sftp
Thank you for your help
My code
I have no authentication problems, and the transfer normally starts after a call to sftp.downloadfile.
The problem occurs during data reception. Sometimes the file loads completely, but very often it freezes during the download without any error, event or timeout. I use the events sftp_DownloadCompleted, sftp_ShowMessage, sftp_DownloadProgress)
The time of freezing is never the same, sometimes at the beginning, sometimes further away. Sometimes the freeze also occurs for 5 or 10 or 20 seconds and it continues for a few hundred additional bytes before locking again.
During a freeze, if I restart the transfer without leaving the application sometimes it happens, sometimes it freezes in another place.
The server I'm exchanging with has no problem, for example during a freeze if I use on the same android phone an transfer application managing the sftp ( AndFTP) to load my file it goes well and moreover with a higher speed than my Android application. Similarly, a Filezilla from a Windows PC works without any problems.
I have of course tried application both in Debug mode, and in release mode, on several phones and versions of Android, and also by putting my code either in an activity or in a service, etc... but the problem occurs exactly the same way.
Are there any "hidden" parameters in JSCH that would allow you to unlock or find out more, where is there another library that manages the sftp
Thank you for your help
My code
B4X:
Sub DownloadFile
sftp.Initialize("sftp", "xxxxx", « xxxxx », "xxx", 22)
sftp.DownloadFile("file", "dataPath","path")
End Sub
Sub sftp_DownloadProgress (ServerPath As String, TotalDownloaded As Long, Total As Long)
lblCount.Text = TotalDownloaded
lblCount2.Text = lblCount2.Text +1
End Sub
Sub sftp_DownloadCompleted (ServerPath As String, Success As Boolean)
If Success Then
Log("dl sucess")
Else
Log ("dl erreur")
End If
End Sub
Sub sftp_PromptYesNo (Message As String)
Log("Prompt YesNo " & Message)
sftp.SetPromptResult(True)
End Sub
Sub sftp_ShowMessage (Message As String)
Log("Show Message : " & Message)
End Sub
Last edited: