471,319 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

downloading a large file!

Hi All,

Quick question, in my program I need to download a large file (100MB)
file. I would like to know how can I do this in segments so that if the
download fails, I will able to download from the the place where the
download fails.

Thanks.

Jan 17 '06 #1
10 5267
Hi,

"DBC User" <db*****@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Hi All,

Quick question, in my program I need to download a large file (100MB)
file. I would like to know how can I do this in segments so that if the
download fails, I will able to download from the the place where the
download fails.


For this to work you need to control both ends of the transmition, do you?
if so you would have to send in the request the offset from the beginning of
the file, after that is as usual, get the bytes, and append them to the
file.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jan 17 '06 #2
I believe you can use HTTP for this. The 1.1 specification has a
provision in it (in the form of a header I believe) which you can set to
indicate where to start the download from. This way, you can indicate which
byte to start at, and then just append to your file.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"DBC User" <db*****@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Hi All,

Quick question, in my program I need to download a large file (100MB)
file. I would like to know how can I do this in segments so that if the
download fails, I will able to download from the the place where the
download fails.

Thanks.

Jan 17 '06 #3
Hello Nicholas Paldino [.NET/C# MVP],
I believe you can use HTTP for this. The 1.1 specification has a
provision in it (in the form of a header I believe) which you can set
to indicate where to start the download from. This way, you can
indicate which byte to start at, and then just append to your file.

Hope this helps.


This header is called "Range". Using it, one can specify one or multiple
byte segments to be retrieved.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Jan 17 '06 #4
It should be noted that you cannot assume that all servers will allow
this. So in that case you'll need to restart the entire download if the
server you are connecting to doesn't support Range.

--
Benny Raymond
http://bloatedcowsoftware.com

Joerg Jooss wrote:
Hello Nicholas Paldino [.NET/C# MVP],
I believe you can use HTTP for this. The 1.1 specification has a
provision in it (in the form of a header I believe) which you can set
to indicate where to start the download from. This way, you can
indicate which byte to start at, and then just append to your file.

Hope this helps.

This header is called "Range". Using it, one can specify one or multiple
byte segments to be retrieved.

Cheers,

Jan 17 '06 #5
Hello Benny,
It should be noted that you cannot assume that all servers will allow
this. So in that case you'll need to restart the entire download if
the server you are connecting to doesn't support Range.


That's correct. A server that supports Range requests should advertise this
capability using the "Accept-Ranges" header.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Jan 17 '06 #6
let me see if I understood this correct

I guess I need to have control over both side and I do. (I am writing a
tray item do this task). From the client side, I call a http page to do
the download (Are we taking file copy over http??) as the file copy is
running I keep track of the offset. If the download breaks in the
middle (that is no response from the server or any other failure), I
re-request the file copy, during the request, I will pass the offset in
the http (how can I do that). To make this happen, I have to have the
download server configured to handle accept-ranges (Where do I do
that??).

Thanks.

Jan 17 '06 #7
Hello DBC,
let me see if I understood this correct

I guess I need to have control over both side and I do. (I am writing
a tray item do this task).
Not really. You just need to identify those servers that accept Range requests.
If a server doesn't support Ranges, you have to repeat the entire download
from scratch.
From the client side, I call a http page to
do the download (Are we taking file copy over http??) as the file copy
is running I keep track of the offset.
Yes, HTTP. I assumed that sort of blindly after Nicolas' reply.
If the download breaks in the
middle (that is no response from the server or any other failure), I
re-request the file copy, during the request, I will pass the offset
in the http (how can I do that).
Add a Range header to your HttpWebRequest by calling AddRange().
To make this happen, I have to have
the download server configured to handle accept-ranges (Where do I do
that??).


That depends on the server or the web application (if there's one involved).
What are using? IIS? Apache?

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Jan 17 '06 #8
I am developing this application using .Net C# 2005 and my IIS is
Windows. As I mentioned, I have a tray icon process which runs in the
background and when it sees a request to download, it will start
downloading based on what I find here. I have 6 servers which are
dedicated to do downloading. All are load balanced.

Jan 18 '06 #9
Hi Jorge,
"Not really. You just need to identify those servers that accept Range
requests.
If a server doesn't support Ranges, you have to repeat the entire
download
from scratch. "

In here how can you make the server to support ranges?

Thanks a lot for all the explanation.

Jan 18 '06 #10
Does anyone know how to make the server to support ranges?

Jan 19 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by sales | last post: by
3 posts views Thread by blantz | last post: by
10 posts views Thread by mwt | last post: by
4 posts views Thread by PiotrKolodziej | last post: by
1 post views Thread by DBC User | last post: by
6 posts views Thread by cyusman | last post: by
35 posts views Thread by keerthyragavendran | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.