scistag.netstag.net_helper.NetHelper¶
- class NetHelper[source]¶
Bases:
objectProvides some basic network usage helper functions
Methods
Returns a free TCP/IP port within a given range
Attributes
__dict____doc____module____weakref__list of weak references to the object (if defined)
- static find_free_ports(host_name='0.0.0.0', port_range=None, count=-1)[source]¶
Returns a free TCP/IP port within a given range
- Parameters
host_name (str) – The host name to search at, e.g “localhost” or “0.0.0.0” for all adapters.
port_range (tuple[int, int] | None) – The range to search within, from .. to. If no range is specified a random port >=1000 will be selected.
count (int) –
The count of ports ot return.
-1 = return all ports in the search range.
count >= 1: Return up to the number of ports
- Returns
The list of ports available in that range