DBusConnection.sendMessage

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

message gio.dbus_message.DBusMessage

a #GDBusMessage

flags gio.types.DBusSendMessageFlags

flags affecting how the message is sent

outSerial uint

return location for serial number assigned to message when sending it or null

Return Value

Type: bool

true if the message was well-formed and queued for transmission, false if error is set