Home > php教程 > PHP开发 > body text

Tips on how to use the netstat command to check port occupancy issues

高洛峰
Release: 2016-12-15 09:41:15
Original
1988 people have browsed it

The netstat command in the Windows system can know the port and process occupancy, so how to operate under the netstat command! Let’s take a look now!

Objective: In the Windows environment, use the netstat command to check a certain Whether the port number is occupied and which process is occupied.

Operation: The operation is divided into two steps: (1) Check which PID the port is occupied; Method 1: View the port in a targeted manner, use the command

Netstat - ano|findstr "", as shown in the figure, the last column is PID. The port number in the picture is 1068, and the corresponding PID is 3840.

Tips on how to use the netstat command to check port occupancy issues

Method 2: View all, and then find the corresponding port and PID.

Tips on how to use the netstat command to check port occupancy issues

Tips on how to use the netstat command to check port occupancy issues

The 5 columns in the first picture are the 5 columns corresponding to the picture in (a) above

   (2) Check the process name corresponding to the PID.

 Method 1: Always use the command to search, tasklist|findstr ""

Tips on how to use the netstat command to check port occupancy issues

As can be seen from Figure (c), the name of the process corresponding to PID 3840 is msnmsgr.exe.

 Method 2: Use Task Manager to view it.

  Bring up the task manager and select the column, as shown in Figure d.

Tips on how to use the netstat command to check port occupancy issues

View the process name corresponding to the PID. As shown in (e) msnmsgr.exe

Tips on how to use the netstat command to check port occupancy issues

Appendix: Enter netstat /? on the command line to view netstat related information.

  C:Documents and SettingsAdministrator>netstat /?

  Displays protocol statistics and current TCP/IP network connections.

 NETSTAT [-a] [-b] [-e] [-n] [-o] [-p proto] [-r] [-s] [-t] [-v] [interval]

   - a Shows all connections and listening ports.

  -b displays the

 executable components included in the creation of each connection or listening port. In some cases an executable component

  is known to have multiple independent components, and in these cases

  a sequence of components

that is involved in creating a connection or listening port is shown. In this case, the executable component name is in [] at the bottom, the component it calls is at the top, and so on, down to the TCP/IP part. Note that this option

 may take a long time and may fail if you do not have sufficient permissions

 .

  -e displays Ethernet statistics. This option can be combined with the -s

  option.

  -n displays the address and port number in numerical form.

  -o Displays the owning process ID associated with each connection.

  -p proto displays connections of the protocol specified by proto; proto can be

  one of the following protocols: TCP, UDP, TCPv6 or UDPv6.

 If used with the -s option to display per-protocol statistics, proto can be one of the following protocols:

 IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPv6.

  -r displays the routing table.

  -s displays per-protocol statistics. By default, statistics for IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPv6 are displayed; the -p option is used to specify a subset of the default cases.

  -t displays the current connection uninstallation status.

  -v when used with the -b option will display the

  components contained in

  that create connection or listening ports for all executable components.

 interval Redisplays selected statistics,

 Pause interval (in seconds) between each display. Press CTRL+C to stop displaying statistics again. If omitted, netstat displays the current

  configuration information (only displayed once)

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template