Port 0 is a wildcard port that tells the system to find a suitable port number.
nc -l 0
: doesn’t work
$ nc -l 0
Ncat: Invalid port number "0". QUITTING.
- Python socket: works
- C/C++ socket: works
Reference: https://www.lifewire.com/port-0-in-tcp-and-udp-818145