NetworkService#
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
NetworkServicerepresenting the givenservice,protocol, anddomain. This will initially be unresolved; use theSocketConnectableinterface 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
srvserves. This might be either UTF-8 or ASCII-encoded, depending on whatsrvwas created with.Added in version 2.22.
Properties#
- class NetworkService