Server Ping with iPhone

2020-03-24 06:33发布

问题:

I'm writing an app that needs to know which of two servers responds fastest. One server is in my time zone, the other is far away.

How do I get the round trip time from a server ping on the iPhone?
I looked at Reachability, and I don't think it does what I need in this case. Alternate solutions are welcome as well. Thanks!

回答1:

You could use this implementation of ping - source

Or, Apple has an example App you can look at - SimplePing

Another option is to use an existing lib: http://www.kernelthread.com/projects/hanoi/html/icmp.html