Method

GioDBusConnectionsend_message

since: 2.26

Declaration [src]

gboolean
g_dbus_connection_send_message (
  GDBusConnection* connection,
  GDBusMessage* message,
  GDBusSendMessageFlags flags,
  volatile guint32* out_serial,
  GError** error
)

Description [src]

Asynchronously sends message to the peer represented by connection.

Unless flags contain the G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number will be assigned by connection and set on message via g_dbus_message_set_serial(). 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 G_IO_ERROR_CLOSED. If message is not well-formed, the operation fails with G_IO_ERROR_INVALID_ARGUMENT.

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 G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.

Available since: 2.26

Parameters

message

Type: GDBusMessage

A GDBusMessage.

The data is owned by the caller of the method.
flags

Type: GDBusSendMessageFlags

Flags affecting how the message is sent.

out_serial

Type: volatile guint32*

Return location for serial number assigned to message when sending it or NULL.

The argument will be set by the function.
The argument can be NULL.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the method if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gboolean

TRUE if the message was well-formed and queued for transmission, FALSE if error is set.