public DBusMessage send_message_with_reply_sync (DBusMessage message, DBusSendMessageFlags flags, int timeout_msec, out uint32 out_serial = null, Cancellable? cancellable = null) throws IOError

Synchronously sends message to the peer represented by this and blocks the calling thread until a reply is received or the timeout is reached.

See 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 this and set on message via 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 this 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 throws is only set if a local in-process error occurred. That is to say that the returned DBusMessage object may be of type g_dbus_message_type_error. Use to_gerror to transcode this to a Error.

See this server and 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.



a DBusConnection


a DBusMessage


flags affecting how the message is sent.


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


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


a Cancellable or null


a locked DBusMessage that is the reply to message or null if throws is set