简体   繁体   English

Objective-C中的Traceroute

[英]Traceroute in Objective-C

Does anyone know of a code sample in objective-c for traceroute? 有谁知道Objective-C中的traceroute代码示例? NOTE- I am looking for a code implementation of traceroute/tcptraceroute, NOT a utility. 注意-我正在寻找traceroute / tcptraceroute的代码实现,而不是实用程序。

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 但我同意diciu,您将无法在未越狱的iphone的原始套接字上使用它

As far as I know the standard traceroute requires raw sockets (ie root access). 据我所知,标准traceroute需要原始套接字(即root访问)。 On Mac OS X the traceroute binary is setuid: 在Mac OS X上,traceroute二进制文件是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? 我认为您无法在iPhone上使用原始套接字-也许tcptraceroute是一种选择?

If you want to re-implement traceroute in Objective-C, then you're on your own. 如果您想在Objective-C中重新实现traceroute,那么您就自己一个人。 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. 如果您只想从Objective-C运行traceroute,NSTask对您来说可能是最简单的,但在iPhone上将无法实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM