How to ping multiple hosts using SimplePing?

| | August 7, 2015

I’m using this SimplePing sample code by Apple:
to ping other hosts in the LAN.
I’m using this method:

+ (SimplePing *)simplePingWithHostAddress:(NSData *)hostAddress;

Works fine, but I want to ping multiple hosts at once. I just don’t know how to do that.

I have a NSArray full of IPs (NSString). Can someone please give me an example?


2 Responses to “How to ping multiple hosts using SimplePing?”

  1. You need a fast enumeration loop.

  2. for (int i=0; i<[self.hostArray count]; i++) 
    [SimplePing simplePingWithHostAddress:[hostArray objectAtIndex:i]]; 

Leave a Reply