开发者

How to detect/prevent wifi timeouts on iPhone?

开发者 https://www.devze.com 2023-02-06 07:48 出处:网络
I dont think this i开发者_运维知识库s possible, but can client connected to a wifi hotspot detect or even prevent a disconnect due to a timeout?

I dont think this i开发者_运维知识库s 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号