我目前正在开发一种网络诊断应用程序,其中我需要跟踪所有IP地址的数据包死记硬背。我认为所有信息都在OSI模型层中。 3网络层,但我无法提取此信息。
我正在使用cocoaasyncsocket库来创建套接字我也能够发送和接收数据,但却没有得到如何提取图层信息。以下是我使用cocoaasyncsocket的方法。
// To send data
char bytes[] = "abcd\r\n";
NSData* data = [[NSData alloc] initWithBytes:bytes length:sizeof(bytes)];
[socket writeData:data withTimeout:-1 tag:0];
// To read data
- (void)onSocket:(AsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag
{
NSString* newStr = [NSString stringWithUTF8String:[data bytes]];
NSLog(@"socket socketDidReadData:%@", newStr);
}
In this link apple say packet tracing is not possible on iPhone, but I am still not sure. https://developer.apple.com/library/ios/qa/qa1176/_index.html#//apple_ref/doc/uid/DTS10001707-CH1
下面是我需要在iPhone上绘制类似内容的图表。我在过去的两天里一直在努力,并且能够获得与此相关的任何其他信息。
I found a solution but It’s require a MAC system and also a MAC app which will grab this info and then send to iPhone via USB cable. http://useyourloaf.com/blog/remote-packet-capture-for-ios-devices/
任何有用的链接,信息都可以节省我的时间。