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 ?
After some searching I found Apple's code used for netstat.
Everything you need in the void protopr(uint32_t proto, char *name, int af)
function.
I tested on the device and sysctlbyname("net.inet.tcp.pcblist_n",...)
works.
That should be all you need.
I can't test this but from what I gather you will have to use sysctl
in combination with sysctlnametomib
or alternatively sysctlbyname
for this:
sysctlbyname("net.inet.tcp.pcblist", ...)
and/or
sysctlbyname("net.inet.udp.pcblist", ...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With