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:
http://lists.apple.com/mailman/options/macnetworkprog/email@hidden