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 g_dbus_connection_send_message_with_reply() for the asynchronous version of this method.

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.

If connection is closed then the operation will fail with G_IO_ERROR_CLOSED. If cancellable is canceled, the operation will fail with G_IO_ERROR_CANCELLED. If message is not well-formed, the operation fails with G_IO_ERROR_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 G_DBUS_MESSAGE_TYPE_ERROR. Use g_dbus_message_to_gerror() 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 G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.

class DBusConnection
sendMessageWithReplySync

Parameters

message DBusMessage
flags GDBusSendMessageFlags

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 Cancellable

a gio.Cancellable or NULL

Return Value

a locked gio.DBusMessage that is the reply to message or NULL if error is set

Throws

GException on failure.

Meta

Since

2.26