lookup_service_async
Description:
[ Version ( since = "2.22" ) ]
public async List<SrvTarget> lookup_service_async (string service, string protocol, string domain, Cancellable? cancellable = null) throws Error
public async List<SrvTarget> lookup_service_async (string service, string protocol, string domain, Cancellable? cancellable = null) throws Error
Begins asynchronously performing a DNS SRV lookup for the given service
and protocol
in the given domain
, and eventually calls callback
, which must call lookup_service_async.end to get the final result.
See lookup_service for more details.
Example: Resolver, service-lookup, async, (1):
public static int main () {
MainLoop loop = new MainLoop ();
Resolver resolver = Resolver.get_default ();
resolver.lookup_service_async.begin ("pop3", "tcp", "gmail.com", null, (obj, res) => {
try {
List<SrvTarget> targets = resolver.lookup_service_async.end (res);
foreach (SrvTarget target in targets) {
print ("host: %s\n", target.get_hostname ());
print (" port: %hu\n", target.get_port ());
print (" priority: %hu\n", target.get_priority ());
print (" weight: %hu\n", target.get_weight ());
}
} catch (Error e) {
print ("Error: %s\n", e.message);
}
loop.quit ();
});
// Block until loop.quit is called:
loop.run ();
return 0;
}
valac --pkg gio-2.0 GLib.Resolver.lookup_service_async.vala
Parameters:
this |
a Resolver |
service |
the service type to look up (eg, "ldap") |
protocol |
the networking protocol to use for |
domain |
the DNS domain to look up the service in |
cancellable |
a Cancellable, or null |
callback |
callback to call after resolution completes |
user_data |
data for |