[comp.protocols.tcp-ip] getting processid from netstat

barrym@infmx.UUCP (Barry Mednick) (12/16/89)

Given the output from netstat -A, can I relate one of the connections
to a processid?  In particular, can I use the foreign address or the
Process Control Block address to derive the process id that is using
that connection?

Please e-mail !pyramid!infmx!barrym  or call 415 926-6674

Thanks for your help.

abe@mace.cc.purdue.edu (Vic Abell) (12/18/89)

In article <2829@infmx.UUCP>, barrym@infmx.UUCP (Barry Mednick) writes:
> Given the output from netstat -A, can I relate one of the connections
> to a processid?  In particular, can I use the foreign address or the
> Process Control Block address to derive the process id that is using
> that connection?

% netstat -aA | grep smtp
80f67d0c tcp        0      0  *.smtp             *.*                LISTEN
% ofiles -n 80f67d0c

file 8010309c of socket 80f67d8c of INPCB 80f6790c of PCB 80f67d0c	
USER        PID  TYPE    FD  CMD           
root        148  sock     5  sendmail      

Ofiles is available in volume 18 of comp.sources.unix, number 57.