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?