iOS 网络可达性 - 似乎不起作用

标签 ios networking reachability

我正在关注 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/

相关文章:

ios - 如何在 API .js 上连接我的 iOS 应用程序

java - 从我的网站下载 iOS 和 Android 应用程序?

networking - 生成图形的图片/图形

linux - 除 iptables 外的数据包处理实用程序?

objective-c - 在另一种方法中添加事件指示器以避免挂起

javascript - react native - react-native-maps 在 iOS 上性能缓慢

iphone - 如何从导航堆栈中的任何位置弹出到任意 View Controller

c# - 将数据从服务器顺序传输到多个客户端

ios - 尝试使用 Alamofire 检查 iOS 设备上的互联网连接

ios - 在 iPhone 模拟器上使用可达性并且没有 wifi