What Ports My Computer Is Using?

Updated Jul 25, 2023

Reported In

Other

Computer Ports
NI Hardware 

Issue Details

I have NI hardware that is communicating with my computer over the network and I am having troubles with my firewall settings. 

How can I tell what ports my computer is currently communicating on?

Solution

Your Microsoft Windows computer will tell you which ports it is currently communicating on using the netstat command in a Command Prompt window.

Start Menu » Programs » Accessories » Command Prompt 

Additional Information

The netstat command also allows you to see which IP addresses are communicating over each port.  This can be very useful when debugging network connections between specific targets.


Netstat can accept a variety of parameters to help give faster access to the data you wish to find.  The following parameters can be particularly helpful.

-a  - Shows only the active TCP and UDP connections
- - This will display the program associated with the connection.  This is similar using the "-o" option below, but may take significantly longer time to execute depending upon your network setup.
- - This allows you to request information about a specific protocol.  For example "netstat -p udp" will return all the UDP connections on your computer.
- - This will include the PID (Process ID) for the network connections.  This can help you isolate which program is using each port.  If you suspect an application is using a port you are trying to access, you can verify using this parameter.  Once you have the PID number for the port in question, open Task Manager and go to the Process tab.  Here select View»Select Columns... Place a check mark in the box titled PID.  You can then sort the processes by PID by clicking on that column.  Scroll through this list till you find the PID of interest, and you will know what program it is associated with.

There are other parameters netstat accepts as well.  For a complete list please refer to the related links section.