How to Ping or check if server of particular IP Ad

2019-01-21 23:01发布

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.

3条回答
神经病院院长
2楼-- · 2019-01-21 23:16

If you want to ping the server, try this:

SimplePing

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

查看更多
Explosion°爆炸
3楼-- · 2019-01-21 23:29

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.

查看更多
一纸荒年 Trace。
4楼-- · 2019-01-21 23:40

You need Apple's Reachability Sample Application.

查看更多
登录 后发表回答