title: How to write a simple Ping method in Cocoa/Objective-C
body: <p>I need to write a simple <code>ping</code> method in Cocoa/Objective-C. It also needs to work on the iPhone.</p>
  
  <p>I found an example that uses <code>icmp</code>, will this work on the iPhone?</p>
  
  <p>I'm leaning towards a solution using <code>NSNetServices</code>, is this a good idea?</p>
  
  <p>The method only needs to <code>ping</code> a few times and return the average and -1 if the host is down or unreachable.</p>