我正在关注
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之类的Web请求,并且不会阻止设备成功发送数据包.