当前位置:网站首页>Come in and teach you how to solve the problem of port occupation

Come in and teach you how to solve the problem of port occupation

2022-04-23 20:31:00 Different 213

close windows Port occupied in , Like the ones that we see all the time 8080 The port is occupied , Solve the problem easily in two steps .

One : Find port PID( The following contents are as follows 8080 For example, the port is occupied )

Open the command line tool , Input :netstat -aon|findstr "8080"

Get the information shown in the figure below :

image-20210129162037244

  • TCP For the agreement
  • 0.0.0.0:8080 For local address
  • 0.0.0.0:0 Is the external address
  • LISTENING Indicates that the port is listening
  • 10224 That's what we're looking for PID

Two : close PID process

Open Task Manager , find PID Corresponding process location , End the process .

As shown in the figure below :

image-20210129162852483

At this point, the problem of port occupation is solved ! Want to continue to learn more about how to query ports PID Problem partner , You can continue to read article 3 .

3、 ... and : netstat command ( Check the port )

​ netstat Commands are used to display and IP 、TCP 、UDP and ICMP Protocol related statistics , Generally used to check the network connection of each port of the machine , have access to netstat Command to view the ports in the computer .

Use netstat /? You can see netstat All arguments to the command :

image-20210129163601825

The common parameters are as follows :

-a : Show all active tcp Connect , And computer monitoring tcp and udp port .

-e : Displays the number of bytes sent and received by Ethernet 、 Number of digital packets, etc .

-n : Show all active in numeric form only tcp The address and port number of the connection .

-o : Show active tcp Connect and include processes for each connection id.

-s : Display statistics of various connections by protocol , Including port number .

Among them, there are -a 、-n 、-o Especially commonly used .

What we use netstat -aon|findstr "8080" Orders are based on netstat Command implemented .

findstr yes Window The system's own commands , The purpose is to find one or more specified files, which contain ( Or through parameters /V To control the exclusion of ) Lines of certain strings , And print out the complete information of the line , Or print the file name where the query string is located .

版权声明
本文为[Different 213]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210550450869.html