Resolver.lookupService

Synchronously performs a DNS SRV lookup for the given service and protocol in the given domain and returns an array of gio.SrvTarget domain may be an ASCII-only or UTF-8 hostname. Note also that the service and protocol arguments do not include the leading underscore that appears in the actual DNS entry.

On success, Resolver.lookupService will return a non-empty GList of gio.SrvTarget, sorted in order of preference. (That is, you should attempt to connect to the first target first, then the second if the first fails, etc.)

If the DNS resolution fails, error (if non-NULL) will be set to a value from GResolverError and NULL will be returned.

If cancellable is non-NULL, it can be used to cancel the operation, in which case error (if non-NULL) will be set to G_IO_ERROR_CANCELLED.

If you are planning to connect to the service, it is usually easier to create a gio.NetworkService and use its GSocketConnectable interface.

class Resolver
lookupService

Parameters

service string

the service type to look up (eg, "ldap")

protocol string

the networking protocol to use for service (eg, "tcp")

domain string

the DNS domain to look up the service in

cancellable Cancellable

a gio.Cancellable, or NULL

Return Value

Type: ListG

a non-empty GList of gio.SrvTarget, or NULL on error. You must free each of the targets and the list when you are done with it. (You can use Resolver.freeTargets to do this.)

Throws

GException on failure.

Meta

Since

2.22