about download files

1,517 views
Skip to first unread message

Forrest Lin

unread,
Jul 27, 2010, 3:56:46 AM7/27/10
to asihttp...@googlegroups.com
Hi all,

I plan to use ASIHttpRequest for downloading files from back-end server. Before actions, post questions here to know more about this feature.

As sample source codes given : ( demonstrate downloading remote JPG file ) 

        ASIHTTPRequest *request;
request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/images/small-image.jpg"]];
[request setDownloadDestinationPath:[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"1.png"]];
[request setDownloadProgressDelegate:imageProgressIndicator1];
[networkQueue addOperation:request];


 
My questions are:

1. It can download any formats files, such as MP3, video file etc ?   Any limitations, i,e, file size, time out ?

Seem like that just need set up the remote file path, "http://allseeing-i.com/ASIHTTPRequest/tests/images/small-image.jpg", then it can download everything remotely with HTTP protocol. 

2. How about the resume function ? 

It provides setting for "RESUME" via YES/NO, is that enough for normal resume feature ?  For example, if the file is big, pause it , then hope to resume it from last time.


Thanks for any inputs or comments, I need investigate this before adopting this into my project. Thanks in advance !

Forrest 

--
********************************************
Enjoy eating Apple,such as iPhone,iPad
Skype:  forrest.shi
MSN/Gtalk : apple.dev.sh@gmail.com
http://xcodechina.com
********************************************

Ben Copsey

unread,
Jul 27, 2010, 4:50:37 AM7/27/10
to asihttp...@googlegroups.com
Hi Forrest

> I plan to use ASIHttpRequest for downloading files from back-end server. Before actions, post questions here to know more about this feature.

> ...


> 1. It can download any formats files, such as MP3, video file etc ? Any limitations, i,e, file size, time out ?

Yes, you can download any file, of any size. I think the only theoretical limit is the amount of free space you have on the device.

By default, requests will time out if they have not received any data for 10 seconds. You can increase the timeout period by setting the timeoutSeconds property of the request, or change the default with [ASIHTTPRequest setDefaultTimeoutSeconds:x]. Note that this doesn't mean a download must complete in under 10 seconds, only that it must not get stuck for more than 10 seconds.

> 2. How about the resume function ?
>
> It provides setting for "RESUME" via YES/NO, is that enough for normal resume feature ? For example, if the file is big, pause it , then hope to resume it from last time.

Yes, the resume feature is a good way to handle larger downloads, especially on WWAN connections where losing connectivity is much more common. The two things to remember about resuming downloads are:

* You must configure requests to be resumed in advance - if you might want to resume a request at some future point, you must set it up to be resumed before you start the download (see the documentation for details)
* Not all downloads can be resumed - the server must support resuming for the resource you are downloading. Generally, resuming is not supported if the content is dynamically generated.

Best

Ben

Reply all
Reply to author
Forward
0 new messages