2

I am trying to understand how to use ftp4j to do a multiple threaded upload. From the documentation it says that I can use multiple connections to upload different pieces of the file but how do I control what order they get reassembled on the server? They suggest using this listener but I am not sure what I can do in that completed method to help Stitch the file back together. They do mention ftp append but that only helps if I can control the order that they they finish or are appended.

import it.sauronsoftware.ftp4j.FTPDataTransferListener;

public class MyTransferListener implements FTPDataTransferListener {

    public void started() {
        // Transfer started
    }

    public void transferred(int length) {
        // Yet other length bytes has been transferred since the last time this
        // method was called
    }

    public void completed() {
        // Transfer completed
    }

    public void aborted() {
        // Transfer aborted
    }

    public void failed() {
        // Transfer failed
    }

}
Codeguy007
  • 891
  • 1
  • 12
  • 32

1 Answers1

1

Create two or more threads in Java and run them on different CPU threads. Then in all of those threads you created, upload your things you want to upload.

Edit: You can use zip libraries to split the file(s) and then reassemble them later

Codeguy007
  • 891
  • 1
  • 12
  • 32
batman
  • 90
  • 1
  • 10
  • Yeah, did you bother to read the question or just the title? I know that connecting on multiple threads will allow me to run concurrent transfers. What I don't know is how to reassemble the file fragments in on my java ftp server. – Codeguy007 Jun 29 '15 at 03:01
  • 1
    @Codeguy007 Split the file into as many parts as you have threads that you want to use to upload your file with for example 7zip. Remember to split them to equally large parts. Then send those parts to the server and join them with for example 7zip. I'm not sure whether 7zip has this feature or not. If it doesn't, you can use WinRAR. – batman Jun 29 '15 at 10:31