Basics
Guides
API Reference
Basics
Guides
API Reference
[24:7] extends: object
A GSocketControlMessage is a special-purpose utility message that can be
sent to or received from a [class@Gio.Socket]. These types of messages are
often called ‘ancillary data’. The message can represent some sort of special
instruction to or information from the socket or can represent a special kind
of transfer to the peer (for example, sending a file descriptor over a UNIX
socket). These messages are sent with [method@Gio.Socket.send_message] and
received with [method@Gio.Socket.receive_message]. To extend the set of
control messages that can be sent, subclass this class and override the
get_size, get_level, get_type and serialize methods. To extend the
set of control messages that can be received, subclass this class and
implement the deserialize method. Also, make sure your class is registered
with the [type@GObject.Type] type system before calling
[method@Gio.Socket.receive_message] to read such a message.
SocketControlMessage (Handle = null)
Creates a new
SocketControlMessageby 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.asObject ()
Wraps this handle as
Object.
A Object object.get_level ()
Returns the "level" (i.e. the originating protocol) of the control message. This is often SOL_SOCKET.
get_msg_type ()
Returns the protocol specific type of the control message. For instance, for UNIX fd passing this would be SCM_RIGHTS.
get_size ()
Returns the space required for the control message, not including headers or alignment.
serialize (data)
Converts the data in the message to bytes placed in the message. @data is guaranteed to have enough space to fit the size returned by g_socket_control_message_get_size() on this object.
data is A buffer to write data to.None.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.