I use the JSch library. In the lib list it shows version 1.30 . B4J is v9.8 , Windows 10 Desktop, 64bit
But nothing happen when I try to upload a file. No error nothing. It works with filezilla and other ftp clients. Port 2222 is correct.
The log says :
Waiting for debugger to connect...
Program started.
But nothing happen when I try to upload a file. No error nothing. It works with filezilla and other ftp clients. Port 2222 is correct.
The log says :
Waiting for debugger to connect...
Program started.
B4X:
#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Private Button1 As B4XView
Dim sftp1 As SFtp
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
sftp1.Initialize("sftp1", "xxxxx", "xxxxx", "xxxxxx", 2222)
sftp1.SetKnownHostsStore(File.DirApp, "hosts.txt")
MainForm.Show
End Sub
Sub Button1_Click
'xui.MsgboxAsync("Hello World!", "B4X")
sftp1.UploadFile(File.DirApp,"1001_1.pdf","/test.pdf")
End Sub
Sub sftp1_PromptYesNo (Message As String)
Dim res As Int = fx.Msgbox2(MainForm,Message, "", "Yes", "", "No",Null)
'The next line might be a bit confusing. It is a condition.
'The value will be True if res equals to DialogResponse.POSITIVE.
sftp1.SetPromptResult(res = fx.DialogResponse.POSITIVE)
'sftp1.SetPromptResult(True)
End Sub
Sub sftp1_ShowMessage (Message As String)
fx.Msgbox(MainForm,Message, "")
End Sub
Sub sftp1_UploadProgress (ServerPath As String, TotalUploaded As Long, Total As Long)
Dim s As String
s = "Uploaded " & Round(TotalUploaded / 1000) & "KB"
If Total > 0 Then s = s & " out of " & Round(Total / 1000) & "KB"
Log(s)
End Sub
Sub sftp1_UploadCompleted (ServerPath As String, Success As Boolean)
Log(ServerPath & ", Success=" & Success)
If Success = False Then Log(LastException.Message)
End Sub