Is there a managed class/method that would provide the TCP port number(s) used by a particular Windows processes?
I'm really looking for a .NET equivalent of the following CMD line:
netstat -ano |find /i "listening"
Is there a managed class/method that would provide the TCP port number(s) used by a particular Windows processes?
I'm really looking for a .NET equivalent of the following CMD line:
netstat -ano |find /i "listening"
Except for PID, take a look this:
Source: Netstat in C#
A bit more research bring this: Build your own netstat.exe with c#. This uses P/Invoke to call
GetExtendedTcpTable
and using same structure asnetstat
.See here for an equivalent of netstat in C#: http://towardsnext.wordpess.com/2009/02/09/netstat-in-c/
Update: Link is broken, but here's an equivalent: http://www.timvw.be/2007/09/09/build-your-own-netstatexe-with-c