如何在iPhone中Ping或检查特定IP地址的服务器是否可用/已连接

时间:2021-11-20 16:54:05

I want to Ping or Lookup a particular IP address of server if it is connected or available at that particular time or not in my iPhone application.

我希望Ping或查找服务器的特定IP地址,如果它在特定时间连接或可用,或者不在我的iPhone应用程序中。

I searched a lot over internet but could not find any relevant result for same.

我在互联网上搜索了很多但是找不到任何相关的结果。

Please help me as I am new to this field.

请帮助我,因为我是这个领域的新手。

Thanks in advance.

提前致谢。

3 个解决方案

#1


27  

Apple provides reachability classes you can use the class and

Apple提供了可以使用该类的可访问性类

You can download reachability.h and Reachability.m

您可以下载reachability.h和Reachability.m

And use this as

并用它作为

Reachability* reachability = [[Reachability reachabilityWithHostName: @"www.apple.com"] retain];
NetworkStatus netStatus = [reachability currentReachabilityStatus];

netStatus gives the reachabilty of the server.

netStatus给出了服务器的可达性。

#2


16  

If you want to ping the server, try this:

如果要ping服务器,请尝试以下操作:

SimplePing

SimplePing

It allows for you to ping by either hostname or IP.

它允许您通过主机名或IP进行ping操作。

#3


1  

You need Apple's Reachability Sample Application.

您需要Apple的可达性样本应用程序。

#1


27  

Apple provides reachability classes you can use the class and

Apple提供了可以使用该类的可访问性类

You can download reachability.h and Reachability.m

您可以下载reachability.h和Reachability.m

And use this as

并用它作为

Reachability* reachability = [[Reachability reachabilityWithHostName: @"www.apple.com"] retain];
NetworkStatus netStatus = [reachability currentReachabilityStatus];

netStatus gives the reachabilty of the server.

netStatus给出了服务器的可达性。

#2


16  

If you want to ping the server, try this:

如果要ping服务器,请尝试以下操作:

SimplePing

SimplePing

It allows for you to ping by either hostname or IP.

它允许您通过主机名或IP进行ping操作。

#3


1  

You need Apple's Reachability Sample Application.

您需要Apple的可达性样本应用程序。