user3742125
user3742125

Reputation: 627

Resume file transfer for a halfway failed file transfer with JSch

I am using this JSch library (http://www.jcraft.com/jsch/) in my ColdFusion application. My application wants to implement a retry mechanism – if a file transfer fails halfway through then I want to resume (or continue) the file transfer from where it left off. Is this possible to achieve using this JSch library?

Upvotes: 1

Views: 1371

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202534

Just reconnect and start an upload again with RESUME flag:

channelSftp.put(src, dst, ChannelSftp.RESUME);

The RESUME flag will make JSch query size of a partial remote file and restart the transfer from there. If the file is already uploaded completely, it transfers nothing.

Upvotes: 2

Related Questions