Resolver.lookupService

gio.srv_target.SrvTarget[] lookupService(string service, string protocol, string domain, gio.cancellable.Cancellable cancellable = null)

Synchronously performs a DNS SRV lookup for the given service and protocol in the given domain and returns an array of #GSrvTarget. 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, [gio.resolver.Resolver.lookupService] will return a non-empty #GList of #GSrvTarget, 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 [gio.types.IOErrorEnum.Cancelled].

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

Parameters

servicethe service type to look up (eg, "ldap")
protocolthe networking protocol to use for service (eg, "tcp")
domainthe DNS domain to look up the service in
cancellablea #GCancellable, or null

Returns

a non-empty #GList of

#GSrvTarget, or null on error. You must free each of the targets and the list when you are done with it. (You can use [gio.resolver.Resolver.freeTargets] to do this.)

Throws

[ErrorWrap]