Basics
Guides
API Reference
Basics
Guides
API Reference
[157:14] static extends: object
Alternate constructors for GNetworkAddress. Usage:
GNetworkAddressCtors.<name>(...). The primary constructor lives
directly on GNetworkAddress.
newLoopback (int port)
Creates a new #GSocketConnectable for connecting to the local host over a loopback connection to the given @port. This is intended for use in connecting to local services which may be running on IPv4 or IPv6. The connectable will return IPv4 and IPv6 loopback addresses, regardless of how the host resolves
localhost. By contrast, g_network_address_new() will often only return an IPv4 address when resolvinglocalhost, and an IPv6 address forlocalhost6. g_network_address_get_hostname() will always returnlocalhostfor a #GNetworkAddress created with this constructor.
port is the port.A new GNetworkAddress.[17:7] extends: object
GNetworkAddress provides an easy way to resolve a hostname and then attempt
to connect to that host, handling the possibility of multiple IP addresses
and multiple address families. The enumeration results of resolved addresses
may be cached as long as this object is kept alive which may have
unexpected results if alive for too long. See [iface@Gio.SocketConnectable]
for an example of using the connectable interface.
GNetworkAddress (hostname = null, port = null)
Creates a new #GSocketConnectable for connecting to the given @hostname and @port. Note that depending on the configuration of the machine, a
of localhost may refer to the IPv4 loopback address only, or to both IPv4 and IPv6; use g_network_address_new_loopback() to create a #GNetworkAddress that is guaranteed to resolve to both addresses.hostname is the hostname.port is the port.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.asSocketConnectable ()
Wraps this handle as
GSocketConnectable.
A GSocketConnectable object.get_hostname ()
Gets @addr's hostname. This might be either UTF-8 or ASCII-encoded, depending on what @addr was created with.
@addr's hostname.get_port ()
Gets @addr's port number
@addr's port (which may be 0).get_scheme ()
Gets @addr's scheme
@addr's scheme (%NULL if not built from URI).[182:14] static extends: object
Generated metadata helpers for NetworkAddress class surfaces.
properties ()
Returns property metadata for
NetworkAddress.
A list.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.