如何检测/防止 iPhone 上的 wifi 超时?
我认为这是不可能的,但是连接到 WiFi 热点的客户端可以检测甚至防止由于超时而断开连接吗?
我的猜测是这是不可能的,因为我想象这个超时将是路由器的事情而不是客户端的事情。
如果客户端进行间歇性 ping(例如 IP 地址),这是否可以防止客户端超时?
I dont think this is possible, but can client connected to a wifi hotspot detect or even prevent a disconnect due to a timeout?
My guess is that this is not possible as i would imagine this timeout would be a router thing rather than a client thing.
And if a client makes an intervaled ping (e.g. ip address), would this prevent the client from being timed out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为 WiFi 超时检测可能会浪费你的时间。我只是假设您有连接,然后包括错误纠正并告诉用户您是否无法获取数据。
哦,如果我们是足够优秀的程序员来防止超时......我们就不会编写 iPhone 应用程序。
如果你一直随机进行 ping,那么你会 A) 降低手机速度,B) 无法解决问题。超时的发生有各种各样的原因,并且 ping 可能无法阻止它。
另一方面,如果您真的想了解网络状态...Apple 有这个:
http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html
我还应该注意 ASIHTTPRequest 内置了这个东西...据我所知,无论如何 - 它需要它在 iPhone 上编译。
I think that WiFi timeout detection is probably going to be a waste of your time. I would just assume you have connectivity but then include error correction and tell the user if you couldn't get the data.
Oh, and if we were good enough programmers to prevent timeouts... We wouldn't be writing iPhone apps.
If you just make random pings all the time, you're going to A) slow the phone and B) not solve the problem. Timeouts happen for all sorts of reasons, and pinging probably won't prevent it.
On the other hand, if you really want to know about network state... Apple has this:
http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html
I should also note that ASIHTTPRequest has this stuff built in... As far as I know, anyway - it requires it to compile on iPhone.