On Wed, Jun 19, 2002 at 11:01:19AM +0300, Peter Pentchev wrote: > On Wed, Jun 19, 2002 at 11:48:56AM +0400, Varshavchick Alexander wrote: > > Hi gurus, > > > > can anybody make a hint as how pid of a process listening on a specified > > tcp port can be determined? Of cause there are major utilities like lsof > > or sockstat but they gather a lot of extra information and work not too > > fast. What I need ideally would be a small C program which outputs pid > > given a port number as a parameter, can anybody help? > > Very few things could work faster than lsof(1) with appropriate > command-line options. I would suggest that you take the time to read > the lsof manual page carefully, then try something like: > > lsof -nPli 4tcp:25 > > Of course, depending on your needs, you may want to drop the -P, -l or > -n options.
Hit 'send' too fast; if you are only interested in pid's, take a look at the -t option, too :) G'luck, Peter -- Peter Pentchev [EMAIL PROTECTED] [EMAIL PROTECTED] PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 If there were no counterfactuals, this sentence would not have been paradoxical.
msg35077/pgp00000.pgp
Description: PGP signature