I am doing a job recently, and there is a situation where a port is occupied. You can use the code to check who is occupying the port and terminate the port being occupied.
1. win+r, bring up the command window
2. Input
netstat -ano | findstr 端口
The last string of numbers is the PID number
3. Then enter
tasklist | findstr PID
4. Then enter
taskkill /f /t /pid PID
end port