What is the easiest way to get a PID that listens on a given port in C#? Basically, I want to make sure that my service is running and listens on a port I have provided it.
check out this project: http://www.codeproject.com/KB/IP/iphlpapi.aspx
It uses Interop in C# to get to the underlying GetTcpTable Win API function. And therefore can give you the process id you are looking for.
hope that helps, Alex