Basics
Guides
API Reference
Basics
Guides
API Reference
[181:14] static extends: object
Generated metadata helpers for SocketConnection class surfaces.
properties ()
Returns property metadata for
SocketConnection.
A list.[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].
SocketConnection (Handle = null)
Creates a new
SocketConnectionby 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.asIOStream ()
Wraps this handle as
IOStream.
A IOStream object.connect (object address, object cancellable)
Connect @connection to the specified remote address.
address is a #GSocketAddress specifying the remote address..cancellable is a %GCancellable or %NULL.connect_finish (object result)
Gets the result of a g_socket_connection_connect_async() call.
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.

Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.