free_port_ipv4

Function free_port_ipv4 

Source
pub fn free_port_ipv4() -> (TcpListener, u16)
Expand description

Gets a free IPv4 port from the OS. Returns the listener and the port.

The listener is returned to account for TOCTOU, so that the OS doesn’t release the port for another service before we bind to it for real in our tests.

§Panics

If the port can’t be found within some number of retries (currently 3).