[ale] how does WGET resume downloading a file when interrupted ?

joh6nn joh6nn at hotpop.com
Sat Nov 5 14:36:56 EST 2005


Courtney Thomas wrote:
> That is,..... what is the mechanism by which wget 'knows' where it left
> off in the downloaded fragment and what is the mechanism by which it
> finds that place in the source file ?
>
> Thank you,
> Courtney
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>

though i could be mistaken, i believe that the ability to resume aborted
 transfers is a built-in feature of http.  anyone who knows better, feel
free to correct me, but as i understand it, during the initial
connection set up where the client and server are introducing themselves
and making idle chit-chat, part of what they discuss is the size of the
things to be transferred, and the size of the packets to send it in.
that would mean that a decent implementation of http would be able to do
the following basic math:

x = size of document on server
y = size of packets
z = size of document in client cache

a = x/y = the number of packets that make up the document
b = z/y = the number of packets that have already been sent to the client
c = a-b = the number of packets that the client hasn't received yet.

so, with that simple math out of the way (hopefully i formatted that
well enough that it can be read), a robust http libaray would be able to
keep track of where in the file transfer it was.

then, because http makes allowances for the fact that sometimes packets
get corrupted, or just don't ever arrive, you're allowed to make
requests for specific packets from a document.  so you can start
downloading documents in the middle, if you want to.  which is really
useful, if you've already downloaded the first half of it.

hopefully, that's both correct, and coherent.

--joh6nn



More information about the Ale mailing list