Tuesday, April 21, 2009

How Resumable Download Work

Download, a common activity for most of the IT peoples. Some download manager software support a feature which is resume download, user can pause or stop the download and continue after some time. Starting I thought that must be very complicated implementation within the download manager in order to support resume feature.

Unfortunately, the concept behind that is not that complicated as i thought, after i study on the architecture resume download, I realize the theory behind that is so simple ! The trick to make a download resumable is the HTTP range request header. We know that download file from internet as stream bytes, so we can specific the range header like this

Range : -50000
Range : 0-100000
Range : 50001-

which mean request to download first 50000 bytes, 0-100000 bytes and remaining bytes start from bytes 50001. With these simple tricks and concepts, we can make a download resumable. Let say we downloading a file size 70000 bytes, the connection lose after downloaded for 30000 bytes. So when resume download, client will request bytes 30001 on wards and append on previous downloaded file.

So after understand the theory behind this resume download, i think we can easily create a download manager which is support resume feature.But please remember that resumable download only works provided the server also support resume feature.

No comments: