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

后端 未结 3 1547
渐次进展
渐次进展 2020-12-13 14:29

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

3条回答
  •  遥遥无期
    2020-12-13 15:27

    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.

提交回复
热议问题