pylabrobot.hamilton.transport.text_tcp.resolve_host#

async pylabrobot.hamilton.transport.text_tcp.resolve_host(host: str, timeout: float = 0.5) → str#

Turn what a user gave to connect to a machine into an IPv4 address.

  • An IPv4 address is returned as it is.

  • localhost and names ending in .local are resolved by the system.

  • Anything else is taken to be the name of a machine, and is looked for among the machines that answer the discovery broadcast, by system identifier or module name, ignoring case.

Parameters:
  • host (str) – An IPv4 address, a name the system can resolve, or the name of a machine.

  • timeout (float) – Seconds to wait for answers to the discovery broadcast.

Returns:

The IPv4 address to connect to.

Raises:

ValueError – If the name does not resolve, matches no machine, or matches more than one.

Return type:

str