I'm trying to send a large block of data between applications by sending a control message over DBus from one to the other requesting a Unix file descriptor. I have it so that the client can request this, the server creates a DBus message that includes a UnixFDList
, and the client receives a reply message but it doesn't contain anything. On the server side in Vala the DBusConnection
object is setup using register_object
, unfortunately the Vapi hides the DBusInterfaceVTable
parameter that all the C examples use that would let me specify a delegate for method calls. I've tried to use register_object_with_closures
instead but I can't seem to get that to work and the Closure
object in Vala is woefully undocumented.
It seems to me that I need one of these methods in order to receive the message from the DBusMethodInvocation
object that you get from a call to the DBusInterfaceMethodCallFunc
delegate, with that you can create a reply message. Is there a way to either specify a closure class that works with register_object_with_closures
, or a way to specify a DBusInterfaceVTable
object as part of the service data?
I know that one option is to just create the service in C, but I'd rather figure out and understand how this works in Vala.
Vala uses UnixFDList internally for methods that contain a parameter of type GLib.UnixInputStream, GLib.UnixOutputStream, GLib.Socket, or GLib.FileDescriptorBased.
Example:
[DBus(name="eu.tiliado.Nuvola")]
public interface MasterDbusIfce: GLib.Object {
public abstract void get_connection(
string app_id,
string dbus_id,
out GLib.Socket? socket,
out string? token) throws GLib.Error;
}