How to list all the ports being used?

  • netstat -a -o -n

    will list all of the ports currently open, but can not list ports that might be used by applications or services that are not currently running.

    Is it possible to list all the ports being used even the applications/services are not currently running?

  • You can't do this because applications don't need to register a port. Lots of them ask for a port when they start, and if it's not available, they ask for another one.

    There is no way I know of to be sure you list all the ports the machine will use when all services are running.

  • How about services running on this box? If they use static ports, should be saved somewhere? Registry?

    One of my SQL instance stopped and I could not bring it online because the port was being used already. I could not find that port from the output of netstat. My SQL was back online already. But

    I would like to know how to quickly find out which app/service holds a port or list all the ports being used (either open or not).

    That could be a saver.

  • A service is just a program in an ISM wrapper - there is no special port registry for services, they are like any other apps. To know what port a service might listen on you need to look at the code or doco for that service. As Steve points out some services listen on a dynamic port, determined only at runtime by availability. Other services may have fixed ports but unless you know the service in question the only way you're going to find out what it uses is by (trying to) start it up.

    Regards,

    Jacob

  • Also, I can start a program, open a port, say from an HTML page (java app, etc.) for any port, and use it, then close it, while I'm still running.

    There are "official ports" for many applications, but some people don't respect them. There are also ranges for others. FTP uses 21 to start, but then there's a range for the transfer of data files. SQL Server uses 1434, but it could use other ports at times. File transfers have a decent sized range.

    There's no way to know what's going to be used.

  • There's a cool little program called Aports you can download from the web. No install, just an exe as you would expect. Simple GUI showing you what port each (active) program runs. I was thinking maybe File explorer (from Microsoft) but that may just tell you which dlls active programs use.

    I thought SQL used 1433.

    Hope that helps.

    Lou

  • There are alot of Port Scanner softwares on the web with source code. PortScanner is one of them.

    Atif Sheikh

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • A good tool! Thank you Atif.

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply