When developing under Windows/Linux, it is often encountered that the port is duplicated and the exception is reported: for example
***************************
APPLICATION FAILED TO START
***************************
Description:
Web server failed to start. Port 10000 was already in use.
Action:
Identify and stop the process that's listening on port 10000 or configure this application to listen on another port.
The following describes how to check who occupies a certain port and how to kill the port process.
Windows
1. Open a command window (run as administrator)
window+R key combination, call out the command window.
2. View the PID corresponding to the occupied port
input the command:
netstat -aon|findstr "10000"
Press Enter to execute the command, the last digit is the PID, which is 7992 here .
3. View the process of the specified PID
Continue to enter the command:
tasklist|findstr "7992"
Press Enter to execute the command.
It is a program: yundetectservice.exe occupies the port
4. End the process
Force (/F parameter) to kill all processes with pid 7992 including child processes (/T parameter):
taskkill /T /F /PID 7992
Linux
1. Check the port number occupancy, such as: 6010
netstat -anp |grep 6010
2. End the process that occupies the port
kill -9 2503
3. Check the status of all ports and confirm that the process has ended
netstat -ntlp