find_available_port_in_range

Function find_available_port_in_range 

Source
pub fn find_available_port_in_range(
    ip_addr: IpAddr,
    range: PortRange,
) -> Result<u16>
Expand description

Searches for an open port on a given binding ip_addr in the provided range.

This will start at a random point in the range provided, and search sequenctially. If it can not find anything, an Error is returned.

Keep in mind this will not reserve the port for you, only find one that is empty.