[26:7] extends: object
The object that handles DNS resolution. Use [func@Gio.Resolver.get_default]
to get the default resolver. GResolver provides cancellable synchronous and
asynchronous DNS resolution, for hostnames
([method@Gio.Resolver.lookup_by_address],
[method@Gio.Resolver.lookup_by_name] and their async variants) and SRV
(service) records ([method@Gio.Resolver.lookup_service]).
[class@Gio.NetworkAddress] and [class@Gio.NetworkService] provide wrappers
around GResolver functionality that also implement
[iface@Gio.SocketConnectable], making it easy to connect to a remote
host/service. The default resolver (see [func@Gio.Resolver.get_default]) has
a timeout of 30s set on it since GLib 2.78. Earlier versions of GLib did not
support resolver timeouts. This is an abstract type; subclasses of it
implement different resolvers for different platforms and situations.
GResolver (Handle = null)
Creates a new
Resolverby wrapping a native handle or another wrapper.
Handle is the native handle or another wrapper whose handle to adopt.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asObject ()
Wraps this handle as
GObject.
A GObject object.connectSignal (string Name, CallbackObj)
Connects one generated callback wrapper to a named signal.
Name is the signal name.CallbackObj is the generated callback wrapper to connect.The connected handler id.disconnectSignalHandler (int HandlerId)
Disconnects one retained signal handler id.
HandlerId is the signal handler id to disconnect.None.setOnReload (callback Fn, UserData = null)
Emitted when the resolver notices that the system resolver configuration has changed.
Fn is the Aussom callback.Fn is called with (GResolver Self).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setTimeout (int Value)
The timeout applied to all resolver lookups, in milliseconds. This may be changed through the lifetime of the #GResolver. The new value will apply to any lookups started after the change, but not to any already-ongoing lookups. If this is
0, no timeout is applied to lookups. No timeout was applied to lookups before this property was added in GLib 2.78.
Value is the new property value.None.get_timeout ()
Get the timeout applied to all resolver lookups. See #GResolver:timeout.
the resolver timeout, in milliseconds, or 0 for no timeout.lookup_by_address (object address, object cancellable)
Synchronously reverse-resolves @address to determine its associated hostname. If the DNS resolution fails, @error (if non-%NULL) will be set to a value from #GResolverError. If @cancellable is non-%NULL, it can be used to cancel the operation, in which case @error (if non-%NULL) will be set to %G_IO_ERROR_CANCELLED.
address is the address to reverse-resolve.cancellable is a #GCancellable, or %NULL.a hostname (either ASCII-only, or in ASCII-encoded form), or %NULL on error..lookup_by_address_async (object address, object cancellable, user_data)
Begins asynchronously reverse-resolving @address to determine its associated hostname, and eventually calls @callback, which must call g_resolver_lookup_by_address_finish() to get the final result.
address is the address to reverse-resolve.cancellable is a #GCancellable, or %NULL.callback is callback to call after resolution completes.user_data is data for @callback.None.lookup_by_address_finish (object result)
Retrieves the result of a previous call to g_resolver_lookup_by_address_async(). If the DNS resolution failed,
(if non-%NULL) will be set to a value from #GResolverError. If the operation was cancelled, @error will be set to %G_IO_ERROR_CANCELLED.result is the result passed to your #GAsyncReadyCallback.a hostname (either ASCII-only, or in ASCII-encoded form), or %NULL on error..lookup_by_name (string hostname, object cancellable)
Synchronously resolves @hostname to determine its associated IP address(es). @hostname may be an ASCII-only or UTF-8 hostname, or the textual form of an IP address (in which case this just becomes a wrapper around g_inet_address_new_from_string()). On success, g_resolver_lookup_by_name() will return a non-empty #GList of #GInetAddress, sorted in order of preference and guaranteed to not contain duplicates. That is, if using the result to connect to @hostname, you should attempt to connect to the first address first, then the second if the first fails, etc. If you are using the result to listen on a socket, it is appropriate to add each result using e.g. g_socket_listener_add_address(). If the DNS resolution fails, @error (if non-%NULL) will be set to a value from #GResolverError and %NULL will be returned. If @cancellable is non-%NULL, it can be used to cancel the operation, in which case @error (if non-%NULL) will be set to %G_IO_ERROR_CANCELLED. If you are planning to connect to a socket on the resolved IP address, it may be easier to create a #GNetworkAddress and use its #GSocketConnectable interface.
hostname is the hostname to look up.cancellable is a #GCancellable, or %NULL.a non-empty #GList of #GInetAddress, or %NULL on error. You must unref each of the addresses and free the list when you are done with it. (You can use g_resolver_free_addresses() to do this.).lookup_by_name_async (string hostname, object cancellable, user_data)
Begins asynchronously resolving @hostname to determine its associated IP address(es), and eventually calls @callback, which must call g_resolver_lookup_by_name_finish() to get the result. See g_resolver_lookup_by_name() for more details.
hostname is the hostname to look up the address of.cancellable is a #GCancellable, or %NULL.callback is callback to call after resolution completes.user_data is data for @callback.None.lookup_by_name_finish (object result)
Retrieves the result of a call to g_resolver_lookup_by_name_async(). If the DNS resolution failed, @error (if non-%NULL) will be set to a value from #GResolverError. If the operation was cancelled, @error will be set to %G_IO_ERROR_CANCELLED.
result is the result passed to your #GAsyncReadyCallback.a #GList of #GInetAddress, or %NULL on error. See g_resolver_lookup_by_name() for more details..lookup_by_name_with_flags (string hostname, string flags, object cancellable)
This differs from g_resolver_lookup_by_name() in that you can modify the lookup behavior with @flags. For example this can be used to limit results