I would do it by writing to temporary files. The reason is because when you start writing to an offset in a new file, the write call will block for a long time while Windows zeroes/randomizes the earlier bytes so that you cant read someone elses file that was previously in the same place on the disk. I did a BitTorrent client where it writes pieces randomly into the file and the whole application would lock up when it first starts writing to the end of the file because of this blocking.
As for how to retrieve pieces of the file, just do a REST to set your starting offset, and in your progress event or whatever you use, check if you have received enough data from that connection and close the data socket it if you have (you might receive slightly more than you wanted for that connection but who cares).


Dan

----- Original Message ----- From: "Moacir Flávio Gonçalves" <[EMAIL PROTECTED]>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Wednesday, April 13, 2005 11:40 AM
Subject: Re: [twsocket] Is there a way to download a file in threads?



Well, I'm doing a guess here, thinking that must be a clever way to do it, BUT, I think, if you create 1 file with 33% of junk (just set one byte at the position), another with 66%, then CONTINUE downloading the 3 of then until the start of the next (controling with progress)... Finally, join in one file. Like I said, only guessing...

Rm 12:2 - "E não vos conformeis com este século, mas transformai-vos pela renovação da vossa mente, para que experimenteis qual seja a boa, agradável e perfeita vontade de Deus."

----- Original Message ----- From: "Nicholas Sherlock" <[EMAIL PROTECTED]>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Wednesday, April 13, 2005 2:46 AM
Subject: Re: [twsocket] Is there a way to download a file in threads?



Francois PIETTE wrote:

Some of You guys know Leechget and downloadmanager like that.
They have an option to download a file in threads.


Can you describe this feature because I don't know those programs.


Multiple connections are made to the server. Each connection downloads a separate part of the file and they are reassembled when downloading is done. Eg part 1 would be the first 33% of the file, part 2 the 33-66% part, and part 4 the 66-100% part.

Cheers,
Nicholas Sherlock

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be




--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to