Search code examples
c#.nethttpdownloadlighttpd

Multipart Downloading in C#?


Please excuse my ignorance on the subject.

I would like to write an application in C# that can download files off a server the same way DownThemAll does. DownThemAll seems to open four connections to the HTTP server to download the same file. I was just wondering if there are any existing libraries that might do this.

Here is a quote from their site about this feature:

DownThemAll features a smart download technique called ‘multipart download’. It splits files into multiple sections, which are downloaded simultaneously.

I would also like to be able to pause/resume the downloads. That's the basic functionality I would like, I don't necessarily need a full fledged download manager library, but if there is one that can do these things then I'd love to know about them too. The files are in a password protected directory hosted with lighttpd, so I would also need some way to authenticate myself.

If there aren't any pre-existing libraries that I can use, then what .net classes should I look into that might be able to do this?

Thanks!

EDIT: Reworded the title to be more appropriate and added a quote from the DownThemAll site explaining what it is.

2nd EDIT: I believe svens posted the most appropriate answer so far, although as a comment :/ It's my fault since I misworded the title as I did not know what I was talking about. He posted an article which goes over HTTP download pausing/resuming. It also talks about the Range header which is what I think I'm supposed to use:

The Range header is capable of asking for more than one range in one single request, a feature called "multipart ranges." Don't confuse this with segmented downloading, which almost all downloading tools use to increase the speed of the download. These tools claim to improve download speed by opening two or more simultaneous connections, each of which requests a different range of the file.

So I take it I want to use the range to download certain parts of the file concurrently. Then again this probably doesn't have any advantage over just downloading the file in one go. I'll just do that and allow for pausing/resuming.

Thanks guys!

P.S svens, go ahead and post the comment as an answer so that I can accept it if you want.


Solution

  • I'm with svens on this, http://www.devx.com/dotnet/Article/22533/0/page/2 seems to say it all.