NetworkService#

class NetworkService(**properties: Any)#

Superclasses: Object

Implemented Interfaces: SocketConnectable

Like NetworkAddress does with hostnames, GNetworkService provides an easy way to resolve a SRV record, and then attempt to connect to one of the hosts that implements that service, handling service priority/weighting, multiple IP addresses, and multiple address families.

See SrvTarget for more information about SRV records, and see SocketConnectable for an example of using the connectable interface.

Constructors#

class NetworkService
classmethod new(service: str, protocol: str, domain: str) NetworkService#

Creates a new NetworkService representing the given service, protocol, and domain. This will initially be unresolved; use the SocketConnectable interface to resolve it.

Added in version 2.22.

Parameters:
  • service – the service type to look up (eg, “ldap”)

  • protocol – the networking protocol to use for service (eg, “tcp”)

  • domain – the DNS domain to look up the service in

Methods#

class NetworkService
get_domain() str#

Gets the domain that srv serves. This might be either UTF-8 or ASCII-encoded, depending on what srv was created with.

Added in version 2.22.

get_protocol() str#

Gets srv's protocol name (eg, “tcp”).

Added in version 2.22.

get_scheme() str#

Gets the URI scheme used to resolve proxies. By default, the service name is used as scheme.

Added in version 2.26.

get_service() str#

Gets srv's service name (eg, “ldap”).

Added in version 2.22.

set_scheme(scheme: str) None#

Set’s the URI scheme used to resolve proxies. By default, the service name is used as scheme.

Added in version 2.26.

Parameters:

scheme – a URI scheme

Properties#

class NetworkService
props.domain: str#

The type of the None singleton.

Added in version 2.22.

props.protocol: str#

The type of the None singleton.

Added in version 2.22.

props.scheme: str#

The type of the None singleton.

Added in version 2.22.

props.service: str#

The type of the None singleton.

Added in version 2.22.

Fields#

class NetworkService
parent_instance#
priv#