Multithreaded web downloader (CSMultiThreadedWebDownloader)

The code sample demonstrates downloading files from web using multi-threads

C# (67.9 KB)
 
 
 
 
 
5 Star
(1)
14,460 times
Add to favorites
8/8/2011
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Pause / Resume
    1 Posts | Last post January 06, 2014
    • I've downloaded the source, compiled and tested - it work, but there is a problem with Pause / Resume functionality. Resume is blocking the whole app except progress bar until download is complete. Also, Cancel button is always active.
      
  • Check url
    1 Posts | Last post April 15, 2013
    • Thanks for this code sample, this is useful but I think there is a little problem:
      
      When the downloader checks if the server supports accept-range and retrieve the file size (content length) with the static method CheckUrl of DownloaderHelper, it is actually downloading the full file (ie. the code is not using a HEAD request). 
      
      I'm using Fiddler and CSMultiThreadedWebDownloader.exe, this is what happens:
       - click Check Url: downloads the full file (1st time)
       - click download: this does a check url under the hood (2nd full download)
       - then the concurrent download is triggered (3rd download)
      
      To fix this issue, you'll need to add 
      webRequest.Method = "HEAD";
      just after "var webRequest = InitializeHttpWebRequest(downloader);"
      in DownloaderHelper.CheckUrl
      
      Maybe I missed something?