public async DBusMessage send_message_with_reply (DBusMessage message, DBusSendMessageFlags flags, int timeout_msec, uint32* out_serial = null, Cancellable? cancellable = null) throws IOError

Asynchronously sends message to the peer represented by this.

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.

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.

This is an asynchronous method. When the operation is finished, callback will be invoked in the thread-default main context of the thread you are calling this method from. You can then call send_message_with_reply.end to get the result of the operation. See send_message_with_reply_sync for the synchronous version.

Note that message must be unlocked, unless flags contain the g_dbus_send_message_flags_preserve_serial flag.

See this server and client for an example of how to use this low-level API to send and receive UNIX file descriptors.



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 TaskReadyCallback to call when the request is satisfied or null if you don't care about the result


The data to pass to callback