Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: SocketConnectionMeta

[181:14] static extends: object

Generated metadata helpers for SocketConnection class surfaces.

Methods

  • properties ()

    Returns property metadata for SocketConnection.

    • @r A list.

class: SocketConnection

[24:7] extends: object

GSocketConnection is a [class@Gio.IOStream] for a connected socket. They can be created either by [class@Gio.SocketClient] when connecting to a host, or by [class@Gio.SocketListener] when accepting a new client. The type of the GSocketConnection object returned from these calls depends on the type of the underlying socket that is in use. For instance, for a TCP/IP connection it will be a [class@Gio.TcpConnection]. Choosing what type of object to construct is done with the socket connection factory, and it is possible for third parties to register custom socket connection types for specific combination of socket family/type/protocol using [func@Gio.SocketConnection.factory_register_type]. To close a GSocketConnection, use [method@Gio.IOStream.close]. Closing both substreams of the [class@Gio.IOStream] separately will not close the underlying [class@Gio.Socket].

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • SocketConnection (Handle = null)

    Creates a new SocketConnection by wrapping a native handle or another wrapper.

    • @p 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 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.
  • asIOStream ()

    Wraps this handle as IOStream.

    • @r A IOStream object.
  • connect (object address, object cancellable)

    Connect @connection to the specified remote address.

    • @p address is a #GSocketAddress specifying the remote address..
    • @p cancellable is a %GCancellable or %NULL.
  • connect_finish (object result)

    Gets the result of a g_socket_connection_connect_async() call.

    • @p result is the #GAsyncResult.
  • get_local_address ()

    Try to get the local address of a socket connection.

  • get_remote_address ()

    Try to get the remote address of a socket connection. Since GLib 2.40, when used with g_socket_client_connect() or g_socket_client_connect_async(), during emission of %G_SOCKET_CLIENT_CONNECTING, this function will return the remote address that will be used for the connection. This allows applications to print e.g. "Connecting to example.com (10.42.77.3)...".

  • get_socket ()

    Gets the underlying #GSocket object of the connection. This can be useful if you want to do something unusual on it not supported by the #GSocketConnection APIs.

  • is_connected ()

    Checks if @connection is connected. This is equivalent to calling g_socket_is_connected() on @connection's underlying #GSocket.