如何监控应用程序内的网络活动? [英] How To Monitor Network Activity From Within App?
本文介绍了如何监控应用程序内的网络活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在我正在开发的应用中监控iPhone上的网络活动。 iOS是否支持类似netstat的命令或类似的东西,可以告诉我什么入站和出站连接是活动的?
I'm trying to monitor network activity on my iPhone from within an app I'm developing. Does iOS support a netstat-like command or something similar that can tell me what what inbound and outbound connections are active ?
推荐答案
之后一些搜索我发现用于netstat的Apple代码一>。
After some searching I found Apple's code used for netstat.
void protopr(uint32_t proto,char * name,int af)
函数所需的一切。
我在设备上测试了 sysctlbyname(net.inet.tcp.pcblist_n,...)
工作。
I tested on the device and sysctlbyname("net.inet.tcp.pcblist_n",...)
works.
这应该是你所需要的。
这篇关于如何监控应用程序内的网络活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文