Reputation: 1264
I'm upgrading an application that uses Java to download files over SSH with the sshtools library.
After the ssh connection is set up, I open a SftpClient and start downloading the file using the SftpClient's get method.
At some point I need to pause/stop (it doesn't matter since it is possible to resume a download from a partial file) the download.
I tried to quit()
the SftpClient and then disconnect()
the SshClient but that doesn't seem to have any effect (the download continues).
Has anyone ever tried to achieve this and succeeded (or failed because it's impossible for some reason)?
Thanks!
Edit> The greatest problem I face is that I cannot find an understandable documentation for this project.
Upvotes: 1
Views: 415
Reputation: 94604
you need to pass in an implementation of the FileTransferProgress interface that returns true from the isCancelled()
method as part of the get() invocation. This will allow you to cancel the transfer in progress.
Upvotes: 2