简体   繁体   English

可达性:启用Wifi的飞行模式

[英]Reachability: Airplane Mode with Wifi ON

I'm currently using Reachability to detect an available connection. 我目前正在使用“可达性”来检测可用的连接。 This works great when there's nothing or when there's a good connection. 当没有任何东西或连接良好时,这非常有用。 But what if my user is on a plane with its own wifi node that is not connected to the internet at large? 但是,如果我的用户所在的飞机上有自己的wifi节点,而该节点未与整个Internet相连,那该怎么办? My user will be in airplane mode with wifi on and Reachability gets confused -- it tells me she's connected but she isn't connected enough for my HTTP calls. 我的用户将处于启用Wi-Fi的飞行模式,并且可达性感到困惑-它告诉我她已连接,但连接程度不足以进行HTTP呼叫。

Reachability detects the wifi but is not granular or subtle enough to determine if the wifi is really providing access to the internet. 可达性可检测到wifi,但其粒度或微妙程度不足以确定wifi是否确实提供了对Internet的访问。 This could also happen at a cafe or office when trying to connect to wifi but not having the correct credentials to be authorized. 当尝试连接wifi但没有正确的凭据要授权时,这也可能发生在咖啡馆或办公室。

Is it possible to detect if a wifi node is asking for credentials? 是否可以检测wifi节点是否在请求凭据? Do I need to make an HTTP call to check for true connectivity? 我是否需要进行HTTP调用以检查真正的连通性? Is there a more clever way to solve this problem? 有没有更聪明的方法来解决这个问题?

As far as I know, you will have to do some work to do this. 据我所知,您将需要做一些工作。 FYI, when the interfaces turn on for WiFi and the cell modem, there is the whole handshaking thing when the interface comes back online. 仅供参考,当为WiFi和蜂窝调制解调器打开接口时,当接口重新联机时,整个握手过程就发生了。 There are differences in whether the interface is open and on and whether it has an IP address and whether it can reach an internet address or not. 接口是否处于打开和打开状态,是否具有IP地址以及是否可以访问Internet地址之间存在差异。 I know this matters more when we turn airplane mode off and connectivity resumes, but there is the whole "starting up and acquiring an IP address" thing that sometimes we forget about. 我知道,当我们关闭飞行模式并恢复连接时,这更重要,但是有时整个“启动并获取IP地址”的事情我们有时会忘记。

I'd check the reachability flags for each interface and then see if you can hit an address and get data back over that interface. 我将检查每个接口的可达性标志,然后查看是否可以命中一个地址并通过该接口获取数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM