About download file using ASIHttpRequest

拟墨画扇 提交于 2019-11-30 15:41:46

You posted this on the asi http request group at the same time, and got an answer there:

http://groups.google.com/group/asihttprequest/browse_thread/thread/34eced6759cb7327/47aef091a77331fd?lnk=raot#47aef091a77331fd

(If you're going to post your question in multiple places at the same time, it'd at least be polite to record the fact that you've already got an answer!)

Answers were (from BenC, the ASIHTTPRequest author):

1: 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.

and:

2: 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.

I have encountered the same problem with big files over very unreliable network connection. I have come up a with a solution using ASIHttpRequest to download parts of the simultaneously and concatenating them when done. Here is the code:

https://github.com/anlcan/Happy-Download

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!