freeport
freeport copied to clipboard
GetFreePort() should take IP address; using localhost is not adequate
GetFreePort() assumes use of localhost, but it's not true that all interfaces on a computer will have the same binding. So the fact that something is not bound on localhost does not mean it's not bound on another interface.
This is definitely a problem. As a workaround, it was sufficient to change "localhost:0" to "0.0.0.0:0" to ensure the selected port is free on all interfaces.
I see