0

My app opens random ports from time to time and uses them. I've seen a problem where over a long period of time, there is a resource leak.

Is there a way to programatically get a list of open TCP and UDP ports that my current app is using? I need this information for the currently running app, not for external apps.

Any ideas of how to get a list of open ports without having to just check each port one by one to see if they're opened?

0

1 Answer 1

2

You can use this:
https://code.msdn.microsoft.com/windowsdesktop/C-Sample-to-list-all-the-4817b58f

and take the ports associated with your PID.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.