Basics
Guides
API Reference
Basics
Guides
API Reference
[19:7] extends: object
This is the subclass of [class@Gio.SocketConnection] that is created for UNIX
domain sockets. It contains functions to do some of the UNIX socket specific
functionality like passing file descriptors. Since GLib 2.72,
GUnixConnection is available on all platforms. It requires underlying
system support (such as Windows 10 with AF_UNIX) at run time. Before GLib
2.72, <gio/gunixconnection.h> belonged to the UNIX-specific GIO interfaces,
thus you had to use the gio-unix-2.0.pc pkg-config file when using it. This
is no longer necessary since GLib 2.72.
UnixConnection (Handle = null)
Creates a new
UnixConnectionby 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.asSocketConnection ()
Wraps this handle as
SocketConnection.
A SocketConnection object.receive_credentials (object cancellable)
Receives credentials from the sending end of the connection. The sending end has to call g_unix_connection_send_credentials() (or similar) for this to work. As well as reading the credentials this also reads (and discards) a single byte from the stream, as this is required for credentials passing to work on some implementations. This method can be expected to be available on the following platforms: - Linux since GLib 2.26 - FreeBSD since GLib 2.26 - GNU/kFreeBSD since GLib 2.36 - Solaris, Illumos and OpenSolaris since GLib 2.40 - GNU/Hurd since GLib 2.40 Other ways to exchange credentials with a foreign peer includes the #GUnixCredentialsMessage type and g_socket_get_credentials() function.
cancellable is A #GCancellable or %NULL..receive_credentials_finish (object result)
Finishes an asynchronous receive credentials operation started with g_unix_connection_receive_credentials_async().
result is a #GAsyncResult..receive_fd (object cancellable)
Receives a file descriptor from the sending end of the connection. The sending end has to call g_unix_connection_send_fd() for this to work. As well as reading the fd this also reads a single byte from the stream, as this is required for fd passing to work on some implementations.
cancellable is optional #GCancellable object, %NULL to ignore.send_credentials (object cancellable)
Passes the credentials of the current user the receiving side of the connection. The receiving end has to call g_unix_connection_receive_credentials() (or similar) to accept the credentials. As well as sending the credentials this also writes a single NUL byte to the stream, as this is required for credentials passing to work on some implementations. This method can be expected to be available on the following platforms: - Linux since GLib 2.26 - FreeBSD since GLib 2.26 - GNU/kFreeBSD since GLib 2.36 - Solaris, Illumos and OpenSolaris since GLib 2.40 - GNU/Hurd since GLib 2.40 Other ways to exchange credentials with a foreign peer includes the #GUnixCredentialsMessage type and g_socket_get_credentials() function.
cancellable is A #GCancellable or %NULL..send_credentials_finish (object result)
Finishes an asynchronous send credentials operation started with g_unix_connection_send_credentials_async().
result is a #GAsyncResult..send_fd (int fd, object cancellable)
Passes a file descriptor to the receiving side of the connection. The receiving end has to call g_unix_connection_receive_fd() to accept the file descriptor. As well as sending the fd this also writes a single byte to the stream, as this is required for fd passing to work on some implementations.
fd is a file descriptor.cancellable is optional #GCancellable object, %NULL to ignore..
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.