*BSD News Article 25912


Return to BSD News archive

Xref: sserve comp.sys.sun.admin:24198 comp.unix.bsd:13255
Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!news.uoknor.edu!ns1.nodak.edu!netnews.nwnet.net!news.clark.edu!spool.mu.edu!howland.reston.ans.net!cs.utexas.edu!uunet!digex.net!digex.net!not-for-mail
From: masato@access3.digex.net (J M Thompson)
Newsgroups: comp.sys.sun.admin,comp.unix.bsd
Subject: How to track down process id from socket port?
Date: 12 Jan 1994 10:49:06 -0500
Organization: The Internet
Lines: 19
Message-ID: <2h165i$rcu@access3.digex.net>
NNTP-Posting-Host: access3.digex.net
Keywords: tcp sockets

I would like to determine which process has opened a particular
tcp socket.  For example, from the following output of the 
'netstat -an' command:

  tcp         0     0      *.32160      *.*       LISTEN

I would like to be able to determine the PID for the process that
has tcp socket port 32160 open.

I have tried netstat -A and trying to work from the protocol
control block but to no avail.  I also tried to pstat -f and
trying to connect the socket port to a file descriptor but
I do not see away to do this, and even if I did, I am not sure
how to connect a file descriptor to the process that opened it.

-- 
Jim Thompson                     
email: masato@access.digex.net
phone: 703-759-8252