我正在关注 How to check for an active Internet connection on iOS or OSX?和 http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html测试连接性,但遇到了一些非常基本的问题。
例如,我在另一台机器上运行 .NET API,然后尝试通过我的 mac mini 连接到它。
1) 当 IIS 运行时,一切正常,我很高兴我能正常工作!
2) 我可以完全关闭 IIS(显然,主机无法访问)但是我的 reachabilityWithHostName 仍然报告主机可以访问。
有什么想法吗?
最佳答案
参见 SCNetworkReachability Reference .
The SCNetworkReachability programming interface allows an application to determine the status of a system's current network configuration and the reachability of a target host. A remote host is considered reachable when a data packet, sent by an application into the network stack, can leave the local device. Reachability does not guarantee that the data packet will actually be received by the host.
开启和关闭IIS只是阻止您的服务器接收ftp/http等网络请求,并不会阻止设备成功发送数据包。
关于iOS 网络可达性 - 似乎不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5874445/