K
KGuru
Hi all,
I have tried to understand how to resume an upload or download using
the FTPClient API from Jakarta common net libraries.
1- I started by uploading a file on the FTP server then I interupted
the upload in the middle (after for example 790000 bytes) :
FTPClient ftp=new FTPClient();
....
input = new FileInputStream("fileSourceName");
output = ftp.storeFileStream("fileTargetName");
....
Util.copyStream(input, output);
2- I restart the program but I have added a line of code that describe
an offset:
FTPClient ftp=new FTPClient();
ftp.setRestartOffset(790000);
3- I was expecting that the download will restart from the offset
instead the file upload starts from beginning...
a- In fact i checked the Util.copystream method, i cannot see any use
of the offset or is it simply handled by the FTP server?
b-I'm just wonderinfg thatif it is handled by the FTP server,
how does the FTP server knows where to start etc.. if the connection is
restarted...
c-if anyone has succesfully written the code that handles the "resume"
functionnality, it would be nice to see some code snippet.
Many Thanks!
I have tried to understand how to resume an upload or download using
the FTPClient API from Jakarta common net libraries.
1- I started by uploading a file on the FTP server then I interupted
the upload in the middle (after for example 790000 bytes) :
FTPClient ftp=new FTPClient();
....
input = new FileInputStream("fileSourceName");
output = ftp.storeFileStream("fileTargetName");
....
Util.copyStream(input, output);
2- I restart the program but I have added a line of code that describe
an offset:
FTPClient ftp=new FTPClient();
ftp.setRestartOffset(790000);
3- I was expecting that the download will restart from the offset
instead the file upload starts from beginning...
a- In fact i checked the Util.copystream method, i cannot see any use
of the offset or is it simply handled by the FTP server?
b-I'm just wonderinfg thatif it is handled by the FTP server,
how does the FTP server knows where to start etc.. if the connection is
restarted...
c-if anyone has succesfully written the code that handles the "resume"
functionnality, it would be nice to see some code snippet.
Many Thanks!