Flask allows multiple server instances to listen on the same port Flask allows multiple server instances to listen on the same port flask flask

Flask allows multiple server instances to listen on the same port


This is likely Windows specific behavior and how they manage sockets. On Windows, you can have multiple processes bind to the same port for listening. This was found to cause a lot of security issues, so Windows released updates that can prevent a port from being hi-jacked by another process via the SO_EXCLUSIVEADDRUSE socket flag. You can read more about it at https://docs.microsoft.com/en-us/windows/desktop/winsock/so-exclusiveaddruse

From what I can see by reading through the flask development server code, there is no way for a user to set the SO_EXCLUSIVEADDRUSE flag.