Gene Myers
Gene Myers

Reputation: 1260

Traceroute in Objective-C

Does anyone know of a code sample in objective-c for traceroute? NOTE- I am looking for a code implementation of traceroute/tcptraceroute, NOT a utility.

Upvotes: 3

Views: 3415

Answers (3)

epatel
epatel

Reputation: 46051

You can grab the source code from here. But I agree with diciu, you will not be able to use it on raw sockets on a none-jailbreaked iphone

Upvotes: 4

diciu
diciu

Reputation: 29333

As far as I know the standard traceroute requires raw sockets (i.e. root access). On Mac OS X the traceroute binary is setuid:

cristi:~ diciu$ ls -la /usr/sbin/traceroute
-r-sr-xr-x  1 root  wheel  110112 Oct 16 12:28 /usr/sbin/traceroute

I don't think you can use raw sockets on the iPhone - maybe tcptraceroute is an option?

Upvotes: 1

Azeem.Butt
Azeem.Butt

Reputation: 5861

If you want to re-implement traceroute in Objective-C, then you're on your own. If you just want to run traceroute from Objective-C, NSTask will probably be the easiest for you, but it won't be possible on the iPhone.

Upvotes: 0

Related Questions