开发者

Traceroute in Objective-C

Does anyone know of a code sample in objective-c for traceroute? NOTE- I am looking for a code implementatio开发者_开发百科n of traceroute/tcptraceroute, NOT a utility.


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


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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜