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. If there is an easier way than parsing netstat output it will be great.
Share
from win XP SP2 onwards you can P/Invoke to GetExtendedTcpTable
Using This person’s kind work to flesh out the signature (the PInvoke.net spec is incomplete) here is a (rough and poor at error checking) example