This project is read-only.

Asynchronous transfers

Jun 23, 2013 at 3:04 AM
I just started playing with the library and it appears that the GetFile and PutFile methods are both synchronous. I am wondering what will happen if I move the calls to those functions to separate threads so that I can efficiently transfer many files at once.

Here's the basic idea...
  • Create an arbitrary list of transfer requests
  • Create the FTPConnection object
  • Login
  • Grab up to (maxconnections) items from the transfer request list and create worker threads which call the PutFile or GetFile method of the FTP object.
  • Maintain a counter of how many active worker threads we have going.
  • As each PutFile/GetFile request completes, remove it from the request list, then get next item in list and start processing it.
The big question is, will the connection itself support multiple concurrent transfers going on at once?