Gio.DBusConnection.prototype.send_message_with_reply_sync
function send_message_with_reply_sync(message: Gio.DBusMessage, flags: Gio.DBusSendMessageFlags, timeout_msec: Number(gint), cancellable: Gio.Cancellable): [return_value: Gio.DBusMessage, out_serial: Number(guint32)] { // Gjs wrapper for g_dbus_connection_send_message_with_reply_sync() }
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.DBusConnection.prototype.send_message_with_reply for the asynchronous version of this method.
Unless flags contain the Gio.DBusSendMessageFlags.preserve_serial flag, the serial number will be assigned by connection and set on message via Gio.DBusMessage.prototype.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.
If connection is closed then the operation will fail with Gio.IOErrorEnum.closed. If cancellable is canceled, the operation will fail with Gio.IOErrorEnum.cancelled. If message is not well-formed, the operation fails with Gio.IOErrorEnum.invalid_argument.
Note that @error is only set if a local in-process error occurred. That is to say that the returned Gio.DBusMessage object may be of type Gio.DBusMessageType.error. Use Gio.DBusMessage.prototype.to_gerror to transcode this to a GLib.Error.
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.DBusSendMessageFlags.preserve_serial flag.
Since 2.26
- message
- flags
flags affecting how the message is sent.
- timeout_msec
the timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout
- cancellable
a Gio.Cancellable or null
- return_value
a locked Gio.DBusMessage that is the reply to message or null if @error is set
- out_serial
return location for serial number assigned to message when sending it or null