NOTE: These two errnos used in this script may only functional in Windows. You need to modify this script before using this script in *nix systems.
This simple file will allow you to test if a port is available for usage. I recently found that some ports can not be used beacuse of insufficient permission. I wrote this simple script to test how many ports are blocked by sofware firewall installed in my PC. After some search I discovered that it's all Hyper-V's fault. Stop reserving ports, Hyper-V.
Just simply invoke a Python 3.6+ to run this script.
It will test all available ports (1025-65535) by trying to bind to 0.0.0.0
. It will give you a simplified
report after testing.
https://stackoverflow.com/a/54727281
docker/for-win#3171 (comment)