lookup_by_address_async
Description:
[ Version ( since = "2.22" ) ]
public virtual async string lookup_by_address_async (InetAddress address, Cancellable? cancellable = null) throws Error
public virtual async string lookup_by_address_async (InetAddress address, Cancellable? cancellable = null) throws Error
Begins asynchronously reverse-resolving address
to determine its associated hostname, and eventually calls callback
,
which must call lookup_by_address_async.end to get the final result.
Example: Resolver, lookup by address, async:
public static int main () {
MainLoop loop = new MainLoop ();
InetAddress address = new InetAddress.from_string ("208.80.152.201");
Resolver resolver = Resolver.get_default ();
resolver.lookup_by_address_async.begin (address, null, (obj, res) => {
try {
// Output: ``wikipedia-lb.pmtpa.wikimedia.org`` (Wed Oct 24, 20012)
string hostname = resolver.lookup_by_address_async.end (res);
print ("host: %s\n", hostname);
} 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_by_address_async.vala
Parameters:
this |
a Resolver |
address |
the address to reverse-resolve |
cancellable |
a Cancellable, or null |
callback |
callback to call after resolution completes |
user_data |
data for |