• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
tcp connection state information
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: tcp connection state information
      • From: "Justin C. Walker" <email@hidden>
  • Prev by Date: Re: Tracking network traffic
  • Next by Date: Re: tcp connection state information
  • Previous by thread: Re: Socket connection drop
  • Next by thread: Re: tcp connection state information
  • Index(es):
    • Date
    • Thread