Is there an existing tool, which can be used to download big files over a bad connection?
I have to regularly download a relatively small file: 300 MB, but the slow (80-120 KBytes/sec) TCP connection randomly breaks after 10-120 seconds. (It's a big company's network. We contacted their admins (working from India) multiple times, but they can't or don't want to do anything.) The problem might be with their reverse proxies / load balancers.
Up until now I used a modified version of pcurl: https://github.com/brunoborges/pcurl
I changed this line:
curl -s --range ${START_SEG}-${END_SEG} -o ${FILENAME}.part${i} ${URL} &
to this:
curl -s --retry 9999 --retry-delay 3 --speed-limit 2048 --speed-time 10 \
--retry-max-time 0 -C - --range ${START_SEG}-${END_SEG} -o ${FILENAME}.part${i} ${URL} &
I had to add --speed-limit 2048 --speed-time 10
because the connection mostly just hangs for minutes when it fails.
But recently even this script can't complete.
One problem is that it seems to ignore the -C -
part, so it doesn't "continue" the segment after a retry. It seems to truncate the relating temp file, and start from the beginning after each fail. (I think the --range
and the -C
options cannot be used together.)
The other problem is that this script downloads all segments at the same time. It cannot have 300 segments, of which only are 10 being downloaded at a time.
I was thinking of writing a download tool in C# for this specific purpose, but if there's an existing tool, or if the curl command could work properly with different parameters, then I could spare some time.
UPDATE 1: Additional info: The parallel download functionality should not be removed, because they have a bandwidth limit (80-120 Kbytes / sec, mostly 80) per connection, so 10 connections can cause a 10 times speedup. I have to finish the file download in 1 hour, because the file is generated hourly.
rsync
(which will let you restart transfers)?lftp
also allows for automatically restarting transmissions.