ios - 对可达性类的 iPv6 支持
<p><p>我在我的应用程序中使用可达性类来监控网络状态。
Apple 在他们的文档中提到提供对 IPv6 类型的支持。</p>
<p>我发现一些 iPV4 类型在可达性类中使用。
我已经搜索了新的可达性类,但没有找到..
是否有任何新的检查 iPv6 网络可达性状态的类?</p>
<pre><code> + (Reachability*) reachabilityForLocalWiFi;
{
struct sockaddr_in localWifiAddress;
bzero(&localWifiAddress, sizeof(localWifiAddress));
localWifiAddress.sin_len = sizeof(localWifiAddress);
localWifiAddress.sin_family = AF_INET;
// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
Reachability* retVal = ;
if(retVal!= NULL)
{
retVal->localWiFiRef = YES;
}
return retVal;
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>找到这个 <a href="https://forums.developer.apple.com/thread/13609" rel="noreferrer noopener nofollow"><strong>on Apple's forums</strong></a> .它最好地描述了这个问题的现状:</p>
<blockquote>
<p><strong>Q:</strong> "We are using reachabilityForLocalWiFi from reachability class? I
noticereachabilityForLocalWiFi method is using
reachabilityWithAddress (local ip address)? I am wondering how will it
work for the ivp6 address? Currently it works for ipv4 address."</p>
<p><strong>A:</strong> (By "the Eskimo"): "I don’t think that will be a problem.Even if
the device only has IPv6 connectivity to the outside world, it should
still be able to get to link-local IPv4 addresses (169.254/16), which
is what +reachabilityForLocalWiFi uses."</p>
</blockquote></p>
<p style="font-size: 20px;">关于ios - 对可达性类的 iPv6 支持,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/33404481/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/33404481/
</a>
</p>
页:
[1]