Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Server Ping with iPhone

In terminal, I Ping www.google.com and I can receive the following data.

64 bytes from 74.125.203.104: icmp_seq=28 ttl=46 time=11.837 ms

But how can I achieve this in iOS, because I need the "time" data, so I can decide which domain is faster for me.

I've searched on the Internet and download Apple's sample code "SimplePing".

I try to import into my iOS project. But the delegate doesn't fire at all.

3 Answers

Im not 100% sure to be honest, id advise you to look at the Apple Docs and see if you can find anything that related to response times.

Hi again Nic!

Achieving what you want seems massively harder than i thought it would be..

I found this which may be of use to you. It a mixture of Apple's Reachability & SimplePing classes which you might be able to adapt to what you want.

http://elbsolutions.com/projects/reachability-with-simpleping-wrapper/

One last thing as well, could you do me a favour and try to refrain from posting multiple time for the same question. Awesome! Scott.

Hi Scott,

Thank you for offering me this. But can I get time data from this ? cuz I ran a few times and I didn't see any method that lets me to read time data.

Sorry for that, I will delete that same question