Reprint please indicate the source: The Curtain Roll westerly column (Http://blog.csdn.net/ljxfblog)
All along, in the process of processing a Linux server, often encountered a problem, sometimes after the kill process, the port is occupied, the new process has not come, wait a few 10 seconds to start normally. So there has been no special treatment for this problem.
In the recent week, this is a frequent occurrence, waiting for a long time can not start a new process, always prompt port is occupied, only restart the machine to return to normal, this is a disaster, so determined to solve the problem.
Looked up some information and learned how to view port occupancy and how to handle it.
1. Use the netstat command to view port usage.
2. We also need to know what the program occupies, plus the-p parameter
3, if more time we can also use grep filter
4. Then kill the process that takes up the port, and under normal circumstances you can start a new process.
Okay, so we've solved the annoying problem of port occupancy.
But I encountered another problem, my code used a parent-child process, kill the parent process, the fork out of the child process is occupied by the parent process to listen to the port, you must kill the processing process to start, temporarily do not know how to solve, and so on later time to check.
Solutions to view and occupy Linux system ports