Wermerb
Wermerb

Reputation: 1049

Advice in a parallel downloading from FTP servers

I'm a newbie Java programmer. In this thread I do not need any specific program code. I just need some advice how to get started with my project.

I have a program which is currently running in PHP and I want to rewrite it in Java for practice.

So the task is:

  1. I have multiple FTP servers lets say 30 (it could be any).
  2. The program have to connect to these ftp servers and download any files it finds.

And that's all. My main issue is that the program has to do this 24/7 and the big question is: Is it possible in Java to make parallel downloads and if so, how should I start?

Any guide or advice is greatly appreciated.

Upvotes: 0

Views: 308

Answers (1)

Cebence
Cebence

Reputation: 2416

Of course it is possible, but as Mr D said it is not something a Java beginner can do.

Just to have an idea what it involves:

  • Multithreading - for each file you wish to download you need one thread that does the job.
  • Handling multiple error conditions that can happen at any moment during download, e.g. connection broken (no Internet connection), wrong URL, can't find server, server not responding etc.
  • Taking care your application doesn't hang if there's no available space on the disk.

And a lot more.

UPDATE: Basically you need one check-and-dispatch class (e.g. DownloadManager) that will periodically go through the list of servers and spawn another FTPDownloder class (implements Runnable) with all information it needs (URL, local filename, timeout etc.) in a new Thread(new FTPDownloader(downloadData)).

Upvotes: 1

Related Questions