2

I am trying to use the low level c-api of DBUS to implement a server-client over sockets. My question is .. is it necessary that a bus should be used always for dbus communication. And does a BUS just means an extra instance of dbus-daemon.

2 Answers2

3

Yes, you need a bus for DBus communication. The bus is a communication channel, nothing more. More buses do not mean more instances of the Dbus daemon, it only means more communication channels.

In a system, you usually have one DBus daemon with one or more buses. Each bus is used for some class of messages (defined in your application).

2 applications can communicate via DBus, bypassing the daemon, by specifying the name of the client to which you want to send the signal/method (the DBus standard allows it). However, I don't think there is a DBus binding that offers this feature. But if you want to use the raw C API of the DBus, you can implement it yourself. You can check this discussion for more information on the topic.

Community
  • 1
  • 1
Alexandru C.
  • 3,337
  • 1
  • 25
  • 27
  • Thank you for the answer. I got a server listening on a tcp socket setup using the GLIB DBUS bindings. But the client needs to be using dbus low-level c-api. I am not able to recognize the part of API which is an 'interface' to dbus-daemon and those parts which are not. Any pointers? And could I find any sample application for dbus low-level c-api using sockets. –  Jul 24 '12 at 01:45
  • 1
    You can look at the low level C API manual [here](http://dbus.freedesktop.org/doc/api/html/index.html). The functions which interact with the message bus seem to be on [this page](http://dbus.freedesktop.org/doc/api/html/group__DBusBus.html). You can find a small tutorial on using the low level API [here](http://www.matthew.ath.cx/misc/dbus). I hope this helps you. – Alexandru C. Jul 24 '12 at 09:46
0

Not sure about C API, but you can have client and server connecting directly using my node.js dbus implementation. Here is an example

Andrey Sidorov
  • 24,905
  • 4
  • 62
  • 75