What am I doing wrong?

Olivier Andrieu oliv__a at projects.sourceforge.net
Wed May 19 09:08:14 PDT 2004


 Tako Schotanus [Wed, 19 May 2004]:
 > 
 > I've got some code here (basically Amaury Jacquot's code with name 
 > changes) that compiles and starts but just doesn't seem te receive any 
 > messages. After starting it in one console window I enter:
 > 
 > dbus-send --system --dest='org.codejive.dbus.test' 
 > /org/codejive/dbus/test/Test org.codejive.dbus.test.Test.Boo

Hmm, unless you've configured your system bus correctly, this won't
work. The system bus has strict policy rules; by default it won't
relay any message. See /etc/dbus-1/system.conf and man dbus-daemon-1.

I'd use the session bus for testing.

 > On the other hand it might be that I just don't understand things 
 > correctly yet. Maybe I _need_ a service for example? And maybe therefore 
 > dbus-send can only be used as a "generic client"?

There's some confusion here: dbus-send sends a signal TO
org.codejive.dbus.test and client.c is set up to receive signals FROM
org.codejive.dbus.test. Since this service does not exist anywhere,
nothing happens.

So, drop the 'sender=' part of the match rule.

Also here:
	if (!dbus_connection_register_fallback(bus_conn, client_path, &client_vtable, NULL)) {
		g_warning("Failed to register server object with the D-BUS bus daemon");
		return -1;
	}

you're not registering anything with the daemon, this registration
only concerns the (local) dispatch of messages, it is handled by the
library. There is no communication with the dameon and the only way
this can fail is because of OOM.

Btw, the client/server naming of applications is a bit inappropriate
when you're dealing with signals. Better terms are 'listener' and
'emitter'. 

-- 
   Olivier



More information about the dbus mailing list