Re: How to find out if a TCP port is in use?
Re: How to find out if a TCP port is in use?
- Subject: Re: How to find out if a TCP port is in use?
- From: Pascal Pochet <email@hidden>
- Date: Sat, 18 Mar 2006 10:36:51 +0100
lsof - like ps - is a tool with the setuid bit set…
-> it requires root privilege for some of its functionalities…
not sure the required info is available to a non-privileged process…
Pascal Pochet
email@hidden
Le 18-mars-06 à 07:05, Chris Ridd a écrit :
On 18/3/06 5:52, Aurélien Hugelé <email@hidden> wrote:
On 17 mars 06, at 19:23, Finlay Dobbie wrote:
On 17/03/06, Stephan Ruggiero <email@hidden-
heidelberg.de> wrote:
Hi,
thank you, I think this should do the trick.
lsof -i :abc
gives me every process listening on or connected to the port abc.
If other user`s processes are needed, you can just run lsof with
sudo.
Well, I wouldn't use this approach if you want to determine this
programmatically.
Can you advice another better approach ?
Do what the lsof program does directly in your code?
The lsof sources that Apple use are available:
<http://darwinsource.opendarwin.org/tarballs/other/lsof-20.tar.gz>
Cheers,
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden