This is because the system needs a certain amount of time to release the port. For example, when writing the flask service, if it is not set to DEBUG mode, CTRL+C will often be required. This will cause the 5000 port to not be released immediately. When the service is started again, it will report that the port is occupied. . If you write the socket service yourself, you can add a line of code to enable the system to release the port immediately after the service stops.
Use the command to view
For example: 1652/nginx: master, where "1652" is the PID and "nginx: master" is the program name.
Use the following command to kill:
If you know what program this is, it is recommended to use the program's own command to stop the service instead of rudely ending it with kill.
The port is open because you have started the related service, you just need to turn off the service
Find the service and kill it or shut down
This is because the system needs a certain amount of time to release the port. For example, when writing the flask service, if it is not set to DEBUG mode, CTRL+C will often be required. This will cause the 5000 port to not be released immediately. When the service is started again, it will report that the port is occupied. . If you write the socket service yourself, you can add a line of code to enable the system to release the port immediately after the service stops.
http://blog.csdn.net/cuiyong_... You can check this blog, it’s more detailed