Port is the communication medium in a computer network. Each port is used for a specific service. Although traffic is received over the same internet connection, it is distributed between different ports for various purposes. The most commonly used ports are TCP and UDP. Each port also has its own port number. There may be situations where two applications use the same port, meaning let's say one application is set up to listen for traffic on the same port and another application is already associated with that port. In this case, errors may occur, so identifying the port in use and taking appropriate action will help achieve the final result. Let’s see how to identify open ports or ports in use on a Windows machine.
The following steps will generate the port currently in use and display the name of the process it is using.
Step 1: Open the Command Prompt by typing cmd in the Windows Search option. Right-click Command Prompt and click Run as administrator .
Step 2: Execute the following command in the command prompt window.
netstat -ab
Step 3: It may take about a minute to complete the execution and display the results. The result has 4 columns Proto, Local Address, Foreign Address and State. Local addressThe number after the colon on the right is Port number, and their status can be seen under the status column. The Established status indicates that the connection is complete and the port is in use.
Sometimes just having the port with the process name is not enough, you also need to dig for more More information. In this case, you can find the process identifier (PID) as well as the port and check the processes in Task Manager.
Step 1: Execute the following command as admin user in the command prompt.
netstat -aon
Step 2: There are 5 columns in the result, the last column is PID. Check the port number you want to investigate and its associated PID. Here I have chosen PID 748 as an example.
Step 3: Right click on the taskbar and go to Task Manager, click on Details Tab. Search for the port and PID you are investigating, you can get more information by looking at the Description column.
Step 4: Once you know which application is causing the problem, you can stop it by clicking End Task, or if you want to investigate further, click Open File location, go to services, etc. These don't have an auto-refresh option, so if you want the latest updates, you'll need to execute the command again.
Let’s use a simple tool called CurrPorts provided by Nirsoft Find out which ports Windows is listening on.
It is a free software tool, so you can download it depending on your compatible version (32-bit or 64-bit)
Step 1: Currport is also a great portable application so you don't need to install it, just unzip the folder and click on the .exe file to execute the application.
Step 2: The result has many columns, such as process name, process ID, protocol, local port, etc. The port number is listed under the Local Port column. This window contains details of the ports in use and closed by the application under the State column. It also contains more information about the port and its associated processes.
Step 3: To make it easier visually, you can also view details of a specific port by double clicking on it.
Step 4: It also has various process related options. If you want to terminate a process running on a specific port or close its connection, you can do this by right-clicking on a specific row and selecting the appropriate option from the list.
Step 5: For clear understanding, you can also click on the View tab at the top and select the relevant option from the list Change the view of the results window.
Step 6: You can also apply filters by clicking on the options tab at the top, assuming you only need to display TCP, UDP ports or any specific filter present in the list, you can Click on them and a check mark will appear next to it. You can also delete the filter by clicking it again.
TCPView is also a freeware tool developed by Sysinternals that provides detailed information about TCP and UDP connections on your system.
Step one: Download the TCPView tool, no need to install. Just unzip the folder and run the executable tcpview.exe file.
Step 2: A window appears with details like process name, PID, etc. The port is listed under Local Port. You can find the highlighted color in the window. Green means connection is open. Yellow means is ready to open , orange means is ready to close.
Step 3: Check the required port, you can right click it and select it from the list Choose the appropriate action, such as closing the connection, terminating the process, etc.
The above is the detailed content of How to check which ports are open in Windows PC. For more information, please follow other related articles on the PHP Chinese website!