--- In [email protected], "Paul Herring" <[EMAIL PROTECTED]> wrote: > > On Wed, Aug 27, 2008 at 6:29 AM, Thomas Hruska <[EMAIL PROTECTED]> wrote: > > Amitabh Shukla wrote: > >> Greetings > >> > >> I need to get the process name that is using an open port on Windows > >> and Unix programatically in C. On unix I think the best way may be > >> read the /proc fs.(I would be glad to know of a better/more portable > >> way.) I don't know how to obtain that information on Windows. > >> Please help me with some pointers on how to go about it. > >> > >> Thanks, > >> AS > > > > Hmm...not sure about *NIX, but the simplest way would be to capture the > > output of 'netstat -o' under Windows (Win2000 and later) and then parse > > it. 'netstat' exists for *NIX, but I don't know if it maps open sockets > > to process IDs. That would be the most portable (albeit "hacky") method. > > netstat -p > > -- > PJH > > http://shabbleland.myminicity.com/ >
why not lsof ?
