lookup_service


Description:

[ Version ( since = "2.22" ) ]
public virtual List<SrvTarget> lookup_service (string service, string protocol, string domain, Cancellable? cancellable = null) throws Error

Example: Resolver, service-lookup, sync (1):

public static int main () {
try {
Resolver resolver = Resolver.get_default ();
List<SrvTarget> targets = resolver.lookup_service ("pop3", "tcp", "gmail.com", null);

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);
}

return 0;
}

valac --pkg gio-2.0 GLib.Resolver.lookup_service.vala