Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to enumerate TCP and UDP listeners



On Oct 20, 2006, at 12:15 PM, email@hidden wrote:

How can I enumerate open TCP and UDP ports on my computer programmatically in OS X? Also, is there a way to enumerate open TCP connections?

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

In Debian, I double checked my ssl port with fuser, which is similar:

fuser -v 443/tcp

No idea how to do it programmatically except for calling one of these with system(). Can anyone else believe that these unix tools just don't take a version number request? I would love to be able to pass 1.0 to lsof and even if it's version 3.0 or whatever, it would return a 1.0 formatted response. This should have been a requirement to get a tool bundled into a distribution, oh, 30 years ago. Hope this helps,

------------------------------------------------------------------------
Zack Morris              Z Sculpt Entertainment               This Space
email@hidden      http://www.zsculpt.com                 For Rent
------------------------------------------------------------------------
If the doors of perception were cleansed, everything would appear to man
  as it is, infinite. -William Blake, The Marriage of Heaven and Hell


_______________________________________________ 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

This email sent to email@hidden
References: 
 >how to enumerate TCP and UDP listeners (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.