lookup_service_fn


Description:

[ CCode ( vfunc_name = "lookup_service" ) ]
[ NoWrapper ]
public virtual List<SrvTarget> lookup_service_fn (string rrname, Cancellable? cancellable = null) throws Error

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

public static int main () {
try {
Resolver resolver = Resolver.get_default ();
List<SrvTarget> targets = resolver.lookup_service_fn ("_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_fn.vala



2022 vala-language.org