Click to See Complete Forum and Search --> : Skipping Bytes takes a long time...
winston2020
May 10th, 2008, 08:59 PM
I'm writing a download accelerator. Basically what it does is spawn several threads, then open URLConnections to the file to be downloaded. Each thread downloads one piece of the file. To accomplish this, I've set it to offset the start point and only read up to piece.length bytes. However, it seems that the piece are skipping at the same rate as the first one is reading, meaning, the second finishes skipping right after the first one finishes reading. This makes the entire thing just go in order instead of downloading simultaneously.
In order to skip I'm using the BufferedInputStream's skip() method. Is there a faster/better way of doing this?
TheCPUWizard
May 10th, 2008, 09:18 PM
Without seeing the actual code, it looks like you are doing the skip on the wrong side of the connection. Therefore ALL of the content is being sent over the connection for each thread, and then being skipped on the recieving side.
If I am correct, then all you have created is a "bandwidth eater" :eek: :eek: :eek: :eek: <munch> <munch> <munch> <munch> <munch> <munch> <munch> <munch>
winston2020
May 10th, 2008, 09:22 PM
Without seeing the actual code, it looks like you are doing the skip on the wrong side of the connection. Therefore ALL of the content is being sent over the connection for each thread, and then being skipped on the recieving side.
If I am correct, then all you have created is a "bandwidth eater" :eek: :eek: :eek: :eek: <munch> <munch> <munch> <munch> <munch> <munch> <munch> <munch>
Yeah, I think you're right ^^;
But then how can programs like Download Accelerator Plus work on only the client side?
If I'm trying to download a file from a server, most likely the server isn't going to store the file in nice little pieces for me right?
So, what do I do?
codeguru.com
Copyright 2007 Jupitermedia Corporation All Rights Reserved.