how download accelerator works

kanak

Member
Joined
Jan 9, 2005
Messages
17
Programming Experience
Beginner
hi all ... i want to know whether anyone has an idea how download accelerator works... I m tryin to implement a downloading tool ... but what i have noticed in all these downloading manager is that they dont store the incoming data in a byte buffer... instead writing it to a temperory file...

i want to know how it is possible... the problem i am facing is that ..
i get the size of the data i want to download and allocate the buffer according to the size... the thing work quite fine...
but the problem comes when the size of the file is large say around 70 to 80 Mb. .. Since i am declaring a byte buffer of 80 mb size... its making me looose my ram memory until the file downloading finishes... that is the problem .....and sometime the computer go low in virtual memory toooo...

so if anyone has an idea of how to over come this problem .. and also any idea on how the download manager do so ... please give me suggestions...
thanks in advance
 
You just figured out why all the download managers write it to a temp file. What happens if the filesize is 1.5gb? Do you have that much RAM in your computer?

Do this instead. Download the file as a stream, saving that stream to a temp file. When the download is complete, move the temp file to its intended spot and delete the temp file. Or download the file to the intended directory, then rename it when the download is completed.
 
Back
Top