How to programmatically find a list open sockets and their associated ports in Windows? RRS feed

  • Question

  • Hello,

    I apologize in advance if this question has already been asked.

    I need to list all open TCP and UDP sockets and their associated ports in a Windows 7 system.  I know how to do this using netstat or netsh, but I need to do it programmatically, either from C++ or C#.  On a related note, I would also like to know how to list all the used (or unused) TCP and UDP port numbers.

    Any help or advice would be greatly appreciated.



    Friday, June 28, 2013 1:29 AM


All replies