python flask server port deforced by ntpd python flask server port deforced by ntpd flask flask

python flask server port deforced by ntpd


ntpd is not listening on TCP port 5000 itself, it's the environment where it is running - the process.

And that process is a child of your Flask server process, which opens a socket listening on TCP port 5000.

This socket is inherited in the child process, and since the ntpd process is a long-running one, it continues running with the socket it inherits from you, occupying the port 5000.

Check how to deal with Python BaseHTTPServer killed,but the port is still be occupied? on how to prevent children processes from inheriting the socket.

Of course, first you have to find a way to customize the way Flask start the server.