A library for resuming and multi-part/multi-threaded downloads in .NET written in C#
The library uses .NET 3.5 and threads to support all platforms from Windows Vista on.
Example for usage: Start a resuming download with 4 parts of this README.md to local file README.md.
varurl=newUri("https://raw.githubusercontent.com/Toqe/Downloader/master/README.md");varfile=newSystem.IO.FileInfo("README.md");varrequestBuilder=newSimpleWebRequestBuilder();vardlChecker=newDownloadChecker();varhttpDlBuilder=newSimpleDownloadBuilder(requestBuilder,dlChecker);vartimeForHeartbeat=3000;vartimeToRetry=5000;varmaxRetries=5;varrdlBuilder=newResumingDownloadBuilder(timeForHeartbeat,timeToRetry,maxRetries,httpDlBuilder);List<DownloadRange>alreadyDownloadedRanges=null;varbufferSize=4096;varnumberOfParts=4;vardownload=newMultiPartDownload(url,bufferSize,numberOfParts,rdlBuilder,requestBuilder,dlChecker,alreadyDownloadedRanges);download.DownloadCompleted+=(args)=>Console.WriteLine("download has finished!");vardlSaver=newDownloadToFileSaver(file);dlSaver.Attach(download);download.Start();For a more sophisticated example also demonstrating the download observers functionality, please have a look at the Downloader.Example project.
.NET by default limits the number of concurrent connections. You can bypass this limit by manually setting the static System.Net.ServicePointManager.DefaultConnectionLimit property to a value appropriate to your application. Please also have a look at the documentation in the MSDN