Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: GNetworkAddressCtors

[157:14] static extends: object

Alternate constructors for GNetworkAddress. Usage: GNetworkAddressCtors.<name>(...). The primary constructor lives directly on GNetworkAddress.

Methods

  • 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 resolving localhost, and an IPv6 address for localhost6. g_network_address_get_hostname() will always return localhost for a #GNetworkAddress created with this constructor.

    • @p port is the port.
    • @r A new GNetworkAddress.

class: 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.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • 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

    • @hostname 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.
    • @p hostname is the hostname.
    • @p 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 exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asObject ()

    Wraps this handle as GObject.

    • @r A GObject object.
  • asSocketConnectable ()

    Wraps this handle as GSocketConnectable.

    • @r 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.

    • @r @addr's hostname.
  • get_port ()

    Gets @addr's port number

    • @r @addr's port (which may be 0).
  • get_scheme ()

    Gets @addr's scheme

    • @r @addr's scheme (%NULL if not built from URI).

class: GNetworkAddressMeta

[182:14] static extends: object

Generated metadata helpers for NetworkAddress class surfaces.

Methods

  • properties ()

    Returns property metadata for NetworkAddress.

    • @r A list.