Skip to content

octoprint.util.net#

address_for_client(host, port, timeout = 3.05, addresses = None, interfaces = None, ignored = None) #

Determines the address of the network interface on this host needed to connect to the indicated client host and port.

interface_addresses(family = None, interfaces = None, ignored = None) #

Retrieves all of the host's network interface addresses.

server_reachable(host, port, timeout = 3.05, proto = 'tcp', source = None) #

Checks if a server is reachable

Parameters:

  • host (str) –

    host to check against

  • port (int) –

    port to check against

  • timeout (float) –

    timeout for check

  • proto (str) –

    tcp or udp

  • source (str) –

    optional, socket used for check will be bound against this address if provided

Returns:

  • boolean

    True if a connection to the server could be opened, False otherwise