Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: SocketAddress

[16:7] extends: object

GSocketAddress is the equivalent of struct sockaddr and its subtypes in the BSD sockets API. This is an abstract class; use [class@Gio.InetSocketAddress] for internet sockets, or [class@Gio.UnixSocketAddress] for UNIX domain sockets.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • SocketAddress (native = null, len = null)

    Creates a #GSocketAddress subclass corresponding to the native struct sockaddr @native.

    • @p native is a pointer to a struct sockaddr.
    • @p len is the size of the memory location pointed to by @native.
  • 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 Object.

    • @r A Object object.
  • asSocketConnectable ()

    Wraps this handle as SocketConnectable.

    • @r A SocketConnectable object.
  • get_family ()

    Gets the socket family type of @address.

  • get_native_size ()

    Gets the size of @address's native struct sockaddr. You can use this to allocate memory to pass to g_socket_address_to_native().

  • to_native (dest, int destlen)

    Converts a #GSocketAddress to a native struct sockaddr, which can be passed to low-level functions like connect() or bind(). If not enough space is available, a %G_IO_ERROR_NO_SPACE error is returned. If the address type is not known on the system then a %G_IO_ERROR_NOT_SUPPORTED error is returned.

    • @p dest is a pointer to a memory location that will contain the native struct sockaddr.
    • @p destlen is the size of @dest. Must be at least as large as g_socket_address_get_native_size().

class: SocketAddressMeta

[157:14] static extends: object

Generated metadata helpers for SocketAddress class surfaces.

Methods

  • properties ()

    Returns property metadata for SocketAddress.

    • @r A list.