DBusConnection.sendMessageWithReplySync

Synchronously sends message to the peer represented by connection and blocks the calling thread until a reply is received or the timeout is reached. See gio.dbus_connection.DBusConnection.sendMessageWithReply for the asynchronous version of this method.

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.

Note that error is only set if a local in-process error occurred. That is to say that the returned #GDBusMessage object may be of type gio.types.DBusMessageType.Error. Use gio.dbus_message.DBusMessage.toGerror to transcode this to a #GError.

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.

timeoutMsec int

the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout

outSerial uint

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

cancellable gio.cancellable.Cancellable

a #GCancellable or null

Return Value

Type: gio.dbus_message.DBusMessage

a locked #GDBusMessage that is the reply to message or null if error is set