tcp connection state information
tcp connection state information
- Subject: tcp connection state information
- From: Tom Gissel <email@hidden>
- Date: Wed, 4 Jun 2008 19:09:15 -0700 (PDT)
Hi,
Is there a way to list all the connections and the state for a particular port/socket? Specifically I'm interested in getting the information for TCP connections and seeing what state those connections are in LISTEN/ESTABLISHED/TIME_WAIT/etc, like netstat/lsof display. I realize that I could execute either these commands and parse the output but both commands have prohibitive cost associated with them. lsof is particularlly slow, on my 2.6 gz macbookpro "lsof -F -i tcp:8081" takes it ~1.187 seconds to execute. netstat is significantly faster, especially
with the -n option, so it must be doing a lot less work...
On Linux I can get this information by reading /proc/net/tcp file but I have not found the equivalent on OS X. Ideally there would be a posix API that would work for both OS X and Linux, but I've not found that either.
Thanks in
advance,
Tom
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden