Active Network Sockets & Connection Inspector #16
Notifications
Due Date
No due date set.
Depends on
#11 Live Process Explorer & Resource Attribution Table
gronod/MacMonitor
#15 Real-Time Network Bandwidth & Interface Throughput
gronod/MacMonitor
Reference: gronod/MacMonitor#16
Reference in New Issue
Block a user
Resolved in Milestone 3. Implemented
MMNetworkSocketsProvider.h/.menumerating active sockets viaproc_listpidsandPROC_PIDFDSOCKETINFO, decoding IPv4/IPv6 endpoints, TCP state machine, and process mapping. Verified with unit tests. Merged intodevelop.Technical Implementation Plan & Code Solution
1. BSD Protocol Control Block (PCB) Architecture
macOS maintains active TCP/UDP socket state tables in kernel memory. These are exposed via
sysctlwithnet.inet.tcp.pcblist_nandnet.inet.udp.pcblist_n.Connection states decoded:
TCPS_CLOSED(0),TCPS_LISTEN(1),TCPS_ESTABLISHED(4),TCPS_CLOSE_WAIT(5),TCPS_TIME_WAIT(9).2. Objective-C Inspector (
MMSocketInspector.m)3. Swift UI Representation
4. Memory & Buffer Safety
Kernel PCB lists can change size between the sizing
sysctlcall and the data retrievalsysctlcall. The code defensively checksinp->xi_lenand loop boundaries to prevent buffer overrun.