Easy-to-use ICMP Ping for iOS (and maybe OSX)
Objective-C Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.



Easy-to-use ICMP ping for iOS - just create a CDZPinger and you delegate gets a callback every second with the average ping time.


Add the dependency to your Podfile:

platform :ios
pod 'CDZPinger'

Run pod install to install the dependencies.


#import "CDZPinger.h" and:

CDZPinger *pinger = [[CDZPinger alloc] initWithHost:@"google.com"];
// keep a strong reference to pinger, maybe in a property somewhere

pinger.delegate = self;
// (assuming self is your CDZPingerDelegate)

In your delegate:

#pragma mark CDZPingerDelegate

- (void)pinger:(CDZPinger *)pinger didUpdateWithAverageSeconds:(NSTimeInterval)seconds
    NSLog([NSString stringWithFormat:@"Received ping; average time %.f ms", seconds*1000]);


CDZPinger requires iOS 5.x+. It might work on iOS 4, but I haven't tested it.

There's also some chance it'll work on OS X, but again, I haven't tested it there either.


MIT License. See LICENSE for the full details.


Chris Dzombak, with ICMP ping code from Apple sample code.