How to List TCP/UDP Connections in iOS 4

前端 未结 1 1238
清酒与你
清酒与你 2020-12-19 09:05

I am interested in deriving a list of active TCP/UDP network connections on an iOS 4.3 device. Basically, I\'m looking for the same type of information one gets from issuin

相关标签:
1条回答
  • 2020-12-19 09:44

    I believe I have now answered my own question. Thought I had taken a close enough look at the sysctl() library function, but I hadn't! For example, the following will yield information about the current TCP connections:

    sysctlbyname("net.inet.tcp.pcblist", ...)
    

    To get information about UDP connection, simply use a different Management Information Base (MIB) name: net.inet.udp.pcblist.

    For convenience, here's a link to the appropriate iOS man page:

    http://developer.apple.com/library/ios/#documentation/System/Conceptual/ManPages_iPhoneOS/man3/sysctlbyname.3.html
    
    0 讨论(0)
提交回复
热议问题