Re: Finding the PID given a TCP connection

From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 02/25/04


Date: Wed, 25 Feb 2004 16:56:40 -0500

In article <pan.2004.02.25.14.20.22.365685@bzzt.net>,
 Arnout Engelen <panner@bzzt.net> wrote:

> For NetHogs (a kind of net-top, http://nethogs.bzzt.net), i'm looking for
> a way to find the PID associated with a given TCP connection. Is there
> a way to do this cross-platformly? I currently read /proc/net/tcp, but
> that is obviously linux-specific.

No, there's no portable way to do this. Programs like "lsof" use
OS-specific techniques tailored to each OS it has been ported to.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***