Gio.Resolver.prototype.lookup_service

function lookup_service(service: String, protocol: String, domain: String, cancellable: Gio.Cancellable): Array(Gio.SrvTarget) {
    // Gjs wrapper for g_resolver_lookup_service()
}
  

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, Gio.Resolver.prototype.lookup_service will return a GLib.List 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 Gio.ResolverError.

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.IOErrorEnum.cancelled.

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

Since 2.22

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

cancellable

a Gio.Cancellable, or null

Returns

a GLib.List 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 Gio.Resolver.free_targets to do this.)