To determine which processes are using specific network ports on a Windows system, you can use built-in command-line tools. This guide demonstrates how to identify port usage and associate it with running applications.
Using Command Prompt
Launch Command Prompt by perssing Win+R, typing "cmd", and pressing Enter.
Display Network Connections with Process Information
The netstat command with specific flags provides detailed connection data:
C:\> netstat -ano
Active Connections
Proto Local Address Foreign Address State PID
TCP 10.0.3.15:51005 111.30.144.123:443 CLOSE_WAIT 932
TCP 10.0.3.15:51049 183.192.199.123:443 CLOSE_WAIT 932
TCP 10.0.3.15:51066 120.204.0.38:80 CLOSE_WAIT 932
TCP 10.0.3.15:51076 223.111.97.203:443 CLOSE_WAIT 932
TCP 10.0.3.15:51122 182.254.88.113:443 CLOSE_WAIT 932
Command parameters explained:
-a: Shows all active connections and listening ports-n: Displays addresses and port numbers numerically-o: Includes the Process ID (PID) for each connection
Identify Process Names by PID
Once you have the PID, use the tasklist command to find the corresponding application:
C:\> tasklist | findstr 932
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
QQ.exe 932 Console 1 182,816 K
Alternatively, open Task Manager, add the PID column through View > Select Columns, enable the PID option, and sort by PID to locate the process.
Additional Netstat Options
The netstat utility offers extended functionality:
C:\> netstat /?
Displays protocol statistics and current TCP/IP network connections.
NETSTAT [-a] [-b] [-e] [-f] [-n] [-o] [-p proto] [-r] [-s] [-t] [interval]
-a Displays all active connections and listening ports
-b Shows executable involved in creating each connection
-e Displays Ethernet statistics (can be combined with -s)
-f Shows fully qualified domain names for remote addresses
-n Displays addresses and port numbers in numeric form
-o Displays process ID associated with each connection
-p Shows connections for specified protocol (TCP, UDP, TCPv6, UDPv6)
-r Displays routing table
-s Displays per-protocol statistics
-t Shows current connection offload state
Network Statistics Examples
View interface and protocol statistics:
C:\> netstat -se
Interface Statistics
Received Sent
Bytes 111120228 17090535
Unicast packets 228885 155724
Non-unicast packets 0 2139
Discarded 0 0
Errors 0 0
Unknown protocols 0
IPv4 Statistics
Packets Received = 144151
Header Errors Received = 0
Address Errors Received = 0
Datagrams Forwarded = 0
Unknown Protocols Received = 0
Received Packets Discarded = 253
Received Packets Delivered = 144175
Output Requests = 90885
Routing Discards = 0
Discarded Output Packets = 0
Output Packets No Route = 18
Reassembly Required = 2
Reassembly Successful = 1
Reassembly Failures = 0
Datagrams Successfully Fragmented = 0
Datagrams Failing Fragmentation = 0
Fragments Created = 0
TCP Statistics for IPv4
Active Opens = 1750
Passive Opens = 0
Failed Connection Attempts = 748
Reset Connections = 122
Current Connections = 9
Segments Received = 130766
Segments Sent = 77334
Segments Retransmitted = 892
UDP Statistics for IPv4
Datagrams Received = 13242
No Ports = 252
Receive Errors = 0
Datagrams Sent = 12661
Routing Table Information
Display currant routing configuration:
C:\> netstat -r
Interface List
14...08 00 27 d8 91 c2 ......Intel(R) PRO/1000 MT Desktop Adapter #2
1...........................Software Loopback Interface 1
IPv4 Route Table
============================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.0.3.2 10.0.3.15 10
10.0.3.0 255.255.255.0 On-link 10.0.3.15 266
10.0.3.15 255.255.255.255 On-link 10.0.3.15 266
127.0.0.0 255.0.0.0 On-link 127.0.0.1 306
127.0.0.1 255.255.255.255 On-link 127.0.0.1 306
============================================================================
Persistent Routes:
None