?
Solved

IMPORTANT: Need Java code to resume FTP transfers

Posted on 2003-03-14
9
Medium Priority
?
235 Views
Last Modified: 2010-03-31
I need the Java code for resuming FTP transfers urgently
0
Comment
Question by:ashish_me2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
9 Comments
 
LVL 92

Expert Comment

by:objects
ID: 8134722
upload or download?

0
 

Author Comment

by:ashish_me2
ID: 8134735
Both upload and download but I am currently interested in resuming the download
0
 
LVL 9

Accepted Solution

by:
Venci75 earned 750 total points
ID: 8134739
     String host = "host";
      int port = 21;
      sun.net.ftp.FtpClient client = new sun.net.ftp.FtpClient(host, port);
      client.login("user", "pass");
      client.sendServer("REST 100");
      if (client.readServerResponse() != 350) {
          throw new IOException("Cannot restart");
      }
      client.get("file.dat"); // you can use also put
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 9

Expert Comment

by:Venci75
ID: 8134746
sorry - should be:
client.sendServer("REST 100\n");
0
 

Author Comment

by:ashish_me2
ID: 8134749
Both upload and download but I am currently interested in resuming the download
0
 
LVL 92

Expert Comment

by:objects
ID: 8134765
Send following ftp commands:
REST <file offset>
STOR <filename>

*and* ensure you start sending the file bytes from the correct offset (or saving for the get).
0
 

Author Comment

by:ashish_me2
ID: 8134772
Both upload and download but I am currently interested in resuming the download
0
 

Author Comment

by:ashish_me2
ID: 8134835
Both upload and download but I am currently interested in resuming the download
0
 

Author Comment

by:ashish_me2
ID: 8134948
Both upload and download but I am currently interested in resuming the download
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question