轮询网络以确定网络是否可达?

发布于 2024-12-13 08:21:11 字数 476 浏览 0 评论 0原文

我试图实现 ASIHTTPRequest 从服务器下载文件。我有一个选项,用户可以将下载添加到队列中,并且 ASINetworkQueue 逐一处理文件下载。

我正在尝试实现一项功能,其中,如果用户失去网络连接,我的 ASINetworkQueue 应持续轮询网络可达性。一旦连接再次可用,应用程序就会开始从上次中断的位置下载文件。

我不是要求代码,但如果有人可以帮助我提供一系列提示,我将不胜感激。


To make my application download the file from where it left off, I am using the ASIHTTPRequest method

[request setAllowResumeForFileDownloads:YES];

I was trying to implement ASIHTTPRequest to download files from a server. I have an option were user can add downloads to a queue and ASINetworkQueue handles the file downloads one by one.

I am trying to implement a feature wherein, if the user loses their network connection, my ASINetworkQueue should poll for network reachability continuously. Once connectivity is available again, the application starts downloading files from where it left off.

I am not asking for code, But I would appreciate if someone can help me with a array of hints.


To make my application download the file from where it left off, I am using the ASIHTTPRequest method

[request setAllowResumeForFileDownloads:YES];

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

久光 2024-12-20 08:21:11

您可以使用 Apple 提供的 Reachability 示例代码中说明的 Reachability API 。请参阅链接。

它允许您在可达性发生变化时接收回调,您还可以在适当的时候轮询可达性,例如在 applicationDidBecomeActive 上,如果您在后台时可达性发生变化,您将不会收到通知。

You can use the Reachability APIs that apple provides illustrated in their Reachability sample code. See link.

It allows you to receive callback when reachability changes, you can also poll reachability when appropriate, such as on applicationDidBecomeActive when if the reachability has changed when you were in the background you wouldn't have been informed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文