DBusConnection.sendMessageWithReply

void sendMessageWithReply(gio.dbus_message.DBusMessage message, gio.types.DBusSendMessageFlags flags, int timeoutMsec, out uint outSerial, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)

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 cancellable is canceled, the operation will fail with [gio.types.IOErrorEnum.Cancelled]. If message is not well-formed, the operation fails with [gio.types.IOErrorEnum.InvalidArgument].

This is an asynchronous method. When the operation is finished, callback will be invoked in the [thread-default main context][g-main-context-push-thread-default] of the thread you are calling this method from. You can then call [gio.dbus_connection.DBusConnection.sendMessageWithReplyFinish] to get the result of the operation. See [gio.dbus_connection.DBusConnection.sendMessageWithReplySync] for the synchronous version.

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

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.

Parameters

messagea #GDBusMessage
flagsflags affecting how the message is sent
timeoutMsecthe timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout
outSerialreturn location for serial number assigned to message when sending it or null
cancellablea #GCancellable or null
callbacka #GAsyncReadyCallback to call when the request is satisfied or null if you don't care about the result