1

In the related question How to improve the Performance of FtpWebRequest? the parallel, asynchronous Upload/Download is mentioned as a suitable way for situations with many files to transfer.

On MSDN there ist an example for asynchronous upload. I didnt find any example how to program the parallel threads tho. So my question is:

//Edited Question:

What ist the proper way to setup the parallel asyncronous uploading/downloading and gathering the responses?

Do hundreds or thousands of asyncronous calls of e.g. FtpWebRequest.BeginGetRequestStream just queue up? No memory issues?

Or would it perform better with just as many calls as the ftpRequest.ServicePoint.ConnectionLimit is set and recall afterwards?

Community
  • 1
  • 1
spaark
  • 701
  • 10
  • 17
  • Why do you need parallel threads? When you start an asynch upload, it doesn't block your current thread, and you should be able to start another upload - does that not work? – Jim W Oct 22 '13 at 21:55
  • @JimW : Thanks for the hint. Threads aren't necessary. I refrased the questions. – spaark Oct 24 '13 at 09:14

1 Answers1

1

There's a private method in FtpControlStream called QueueOrCreateConnection that implies it will be queued, however it also seems like queued calls could be subject to timeout even when in the queue (so if you queue up thousands, it's possible the last items will have timed out before it gets there) - although I'm not totally sure. This is based on Reflector, not experience or testing (so I'd suggest testing it yourself).

I can't post Reflector code here, so I'd suggest looking it up yourself.

Jim W
  • 4,866
  • 1
  • 27
  • 43
  • After testing it with >10000 uploads i couldn't reach a timeout with waiting times up to approx 20 minutes. It seams to be quite reliable. – spaark Apr 17 '14 at 06:47