zut.net.check_tcp_port

zut.net.check_tcp_port(target: str | Collection[str], port: int, *, timeout: float | None = None, stop_on_first: bool = False) list[str]

Return a list of hosts that have the given TCP port open.

Parameters:
  • timeout

    Maximum time to wait for all checks to complete. If None, wait indefinitely.

    Note: Timeout is approximate due to polling granularity and thread race conditions.

  • stop_on_first – Return as soon as at least one host has the given TCP port open.