DBusConnection.sendMessage

bool sendMessage(gio.dbus_message.DBusMessage message, gio.types.DBusSendMessageFlags flags, out uint outSerial)

Asynchronously sends message to the peer represented by connection.

Unless flags contain the [gio.types.DBusSendMessageFlags.PreserveSerial] flag, the serial number will be assigned by connection and set on message via [gio.dbus_message.DBusMessage.setSerial]. If out_serial is not null, then the serial number used will be written to this location prior to submitting the message to the underlying transport. While it has a volatile qualifier, this is a historical artifact and the argument passed to it should not be volatile.

If connection is closed then the operation will fail with [gio.types.IOErrorEnum.Closed]. If message is not well-formed, the operation fails with [gio.types.IOErrorEnum.InvalidArgument].

See this [server][gdbus-server] and [client][gdbus-unix-fd-client] for an example of how to use this low-level API to send and receive UNIX file descriptors.

Note that message must be unlocked, unless flags contain the [gio.types.DBusSendMessageFlags.PreserveSerial] flag.

Parameters

messagea #GDBusMessage
flagsflags affecting how the message is sent
outSerialreturn location for serial number assigned to message when sending it or null

Returns

true if the message was well-formed and queued for

transmission, false if error is set

Throws

[ErrorWrap]