Re: how to enumerate TCP and UDP listeners
Re: how to enumerate TCP and UDP listeners
- Subject: Re: how to enumerate TCP and UDP listeners
- From: Quinn <email@hidden>
- Date: Mon, 23 Oct 2006 09:28:11 +0100
At 13:06 -0600 20/10/06, email@hidden wrote:
There still seems to be a lot of argument about whether it's ok to
call the command line directly, but try these commands:
lsof -i
sudo lsof -i
sudo lsof -i tcp
sudo lsof -i udp
sudo lsof -i tcp:80
I'm not a great fan of the "command line tools are an API" approach,
but in this case it's definitely the best way.
IMPORTANT: "lsof" only deals with descriptors. Any socket that has
no descriptor (for example, sockets opened by the kernel code) will
not appear in the list. To see those you'll have to use alternative
techniques (perhaps the one suggested by Peter).
Can anyone else believe that these unix tools just don't take a
version number request?
When using "lsof" as an API, make sure to specify an explicit output
format using "-F". That generates output that's specifically
designed to be parseable. See <x-man-page://8/lsof> for details.
At 16:29 -0400 20/10/06, Peter Sichel wrote:
I'd love to figure out a stable and efficient way to get all the
connection and process information programatically, but I am unsure
whether it exists at this time.
AFAIK this doesn't exist. Have you filed a bug requesting it? If
so, I'd love to see the bug number.
S+E
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
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