Peer to Peer DBus Connection with Qt

Thiago Macieira thiago at kde.org
Thu Mar 28 10:30:41 PDT 2013


On quinta-feira, 28 de março de 2013 17.28.03, Tim Sander wrote:
> Hi
> 
> I have a qt 4.8.4 base embedded system and i would like to send
> peer to peer dbus messages over the system bus.
> 
> I have build a bare bone example which does not work. Any hints why the peer
> to peer connection is not established would be really nice.

Hi Tim

First of all, you should not package your entire Git repository. You can use 
the git archive command to create a tarball that is suitable for consumption. 
And in your specific case, you only had to send two .cpp files: the client and 
the server.

Unfortunately, your test is invalid. In dbuspeerserver/main.cpp, you do:

   QDBusConnection::systemBus().registerService("this.is.a.peertest");

Registering names on the system bus is only permitted if you have rules 
installed by the system administrator allowing that. So the call above is 
silently failing. In turn, your client is doing:

   QDBusReply<QString> reply=QDBusConnection::systemBus().call(m);
   if(reply.isValid()) {

Since the system bus registration failed, the call above will also fail. 
Therefore, you never enter the block of code that tries to test the peer 
connection.

Conclusion: we have no idea if the peer connection works or not. You did not 
get to test it.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20130328/6d572f5a/attachment.pgp>


More information about the dbus mailing list