Hi,
I am using jkSSH2 for SSH communications.
I have a apllication that connects to a host, retrieve some files and ...
when I change the hostaddress to reconnect to another host. It doesn't work
either I close the connection (ssh.close) or not it doesn't reconnect.
1) I Coneected to any host in my list and retrieve the files, then exit the application - All Ok
I close the connection and try to reconnect. I get errors downloading the files.
I dont close and simply change hosts, user and pass and re-initialize the class. I always get the files from the first host that tconnected.
Help would be greatly appreciated. I wouldnt like my users to have to quit and reenter the application each time they want to change hosts. Below are the 2 routines that initialize, download and close the communication.
I am using jkSSH2 for SSH communications.
I have a apllication that connects to a host, retrieve some files and ...
when I change the hostaddress to reconnect to another host. It doesn't work
either I close the connection (ssh.close) or not it doesn't reconnect.
1) I Coneected to any host in my list and retrieve the files, then exit the application - All Ok
I close the connection and try to reconnect. I get errors downloading the files.
I dont close and simply change hosts, user and pass and re-initialize the class. I always get the files from the first host that tconnected.
Help would be greatly appreciated. I wouldnt like my users to have to quit and reenter the application each time they want to change hosts. Below are the 2 routines that initialize, download and close the communication.
B4X:
Sub SSH_Init
SSH.initialize("SSH", hAddress, 22)
SSH.authenticateWithPassword(hUsername, hPassword)
end Sub
Sub Download
SSH_Init
SSH.getFile ("/home/file2.txt",File.DirDefaultExternal ,12)
SSH.getFile ("/home/file1.txt",File.DirDefaultExternal ,12)
End Sub
Sub SSH_FileDownloadCompleted (Success As Boolean, RemoteFile As String, LocalTargetDirectory As String, TaskId As Int)
if Success = True then
SSh.Close
End if
End Sub
Last edited: