iOS网络可达性 - 似乎不起作用 [英] iOS network reachability - doesn't seem to be working
问题描述
我正在关注如何检查对于iOS或OSX上的活动Internet连接?和 http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html 测试连接性,但遇到了一些非常基本的问题。
I'm following How to check for an active Internet connection on iOS or OSX? and http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html to test for connectivity, but am running into some pretty basic issues.
例如,我正在从另一台机器运行.NET API,然后尝试通过我的mac mini连接到它。
For example, I'm running a .NET API off of another machine and then trying to connect to it via my mac mini.
1)当IIS运行时,一切都正常运行,我很高兴能让它工作!
1) When IIS is running, everything is working like it should, I was excited that I got this working!
2)我可以完全关闭IIS(很明显,主机无法访问),但我的reachabilityWithHostName仍然报告主机可以访问。
2) I can shut off IIS completely (obviously, host is unreachable) but my reachabilityWithHostName is still reporting that the host is reachable.
有任何想法吗?
推荐答案
请参阅 SCNetworkReachability Reference 。
SCNetworkReachability编程
接口允许应用程序以
确定系统的
当前网络配置的状态以及目标主机的
可达性。 当
应用程序发送到网络堆栈的数据包
可以离开本地设备时,
远程主机被视为可达
。
可达性并不保证
数据包实际上是主机收到的
。
打开和关闭IIS只会阻止服务器接收ftp / http等Web请求,并且不会阻止设备成功发送数据包。
Turning IIS on and off is just preventing your server from receiving web request such as ftp/http and does not stop the device from successfully sending a data packet out.
这篇关于iOS网络可达性 - 似乎不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!