简体   繁体   English

iPhone:如何确定主机是否可访问?

[英]iPhone: How can I determine a host is reachable or not?

我如何确定主机,比方说http:// myhost:8080 /是否可以访问。

You could use the Reachability class from Apple, it has a method called -reachabilityWithHostName: , which will inform you if a host is reachable and which connection(s) are available (WiFi, GSM). 您可以使用Apple的Reachability类,它具有一个名为-reachabilityWithHostName:的方法,该方法将通知您主机是否可访问以及哪些连接可用(WiFi,GSM)。

Check the code: http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html 检查代码: http : //developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html

Use the reachability class of apple. 使用苹果的可达性类。 reachability This might help you:) 可达性可能会帮助您:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM