PDA

View Full Version : D-Bus communication over the network



lotek
17th February 2011, 13:31
Hello,

Is it possible to connect to the d-bus daemon running on the remote host?
I've started d-bus daemon on the hostA (192.168.0.1 ) port 12345,
in the config file the <listen>"tcp:host=192.168.0.6,port=12345"</listen> statement is given.
After the daemon has been started, it is possible to call the telnet 192.168.0.1 12345 from a remote host (192.168.0.2)

QDBusConnection::connectToBus("tcp:host=192.168.0.6,port=12345", "test").isConnected();
does not work (returns false)

My question:
Is it possible to connect to the remote d-bus daemon, if yes than how to do this?
Is there any description?

Thanks for any hint.

mcosta
18th February 2011, 16:55
From D-BUS Specification http://www.freedesktop.org/wiki/IntroductionToDBus?action=show&redirect=DBus

You can read

Introduction to D-Bus

D-Bus is an inter-process communication mechanism—a medium for local communication between processes running on the same host. (Inter-host connects may be added in the future, but that is not what D-Bus is meant for).

so, the answer for your question is NO.

wysota
18th February 2011, 19:56
Actually it is not that simple. D-BUS has a mechanism for connecting across network. The thing is only peer-to-peer connections work, not master-slave connections to a remote bus. At least that was the situation two years ago when we were investigating it.

lotek
8th March 2011, 14:28
It Works!!!
Since the version 1.4.1 it is possible to set the
<alow_anonymous/>
tag in the d-bus daemon configuration file.
The file shall contain e.g. following listen tag
<listen>tcp:host=192.168.0.1,port=12345</listen>
A D-Bus daemon shall be started on the according host, using this configuration file.
Than it is possible to open the QDBusConnection over the network. D-Bus works as an ORB !!!

QDBusConnection::connectToBus("tcp:host=192.168.0.1,port=12345","myConnection");

Many thanks to Pavel Strashkin (dbus@lists.freedesktop.org) for help.