简体   繁体   中英

How to Ping or check if server of particular IP Address is available/connected in iPhone

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.

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.

Apple provides reachability classes you can use the class and

You can download reachability.h and 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.

If you want to ping the server, try this:

SimplePing

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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