Using dbus send to 127.0.0.1 for custom method
I am trying to get
to work with address 127.0.0.1 port 10010 for a custom method (
). I wrote for myself. This is not very useful on its own, but I am trying to do something else and this is a test step.
First, I convinced myself that my testing method works as it should. Using the system bus is done locally for my method:
$ dbus-send --system --print-reply --type=method_call --dest=com.example.Test /com/example/Test com.example.Test.TestMethod string:foo method return sender=:1.0 -> dest=:1.17 reply_serial=2 string "returning foo"
Second, the crash
(I don't understand why it doesn't work):
$ dbus-send --address=tcp:host=127.0.0.1,port=10010 --print-reply --type=method_call --dest=com.example.Test /com/example/Test com.example.Test.TestMethod string:foo Error org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
$ DBUS_VERBOSE=1 dbus-monitor --system (nothing)
succeeds. I don't know why this succeeds, while my method fails:
$ dbus-send --address=tcp:host=127.0.0.1,port=10010 --print-reply --type=method_call --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.Hello method return sender=org.freedesktop.DBus -> dest=:1.15 reply_serial=1 string ":1.15"
I made some changes to the config file
<auth>ANONYMOUS</auth> <allow_anonymous/> <listen>tcp:host=127.0.0.1,port=10010</listen> <allow send_destination="com.example.Test"/> <allow own="com.example.Test"/>
For debugging I used
, but I don't see anything useful in the output. A failure case and a success case have a minimally different output:
Successful case (
[89 bytes [ ] have 89 bytes, need body 9 + header 80 = 89 [ ] validating body from pos 0 len 89 sig 'yyyyuua(yv)'] read
Bad case (
[dbus/dbus-transport-socket.c(873):do_reading] Disconnected from remote app [dbus/dbus-transport.c(502):_dbus_transport_disconnect] start [dbus/dbus-transport-socket.c(1017):socket_disconnect] [dbus/dbus-transport-socket.c(76):free_watches] start [dbus/dbus-watch.c(628):dbus_watch_set_data] Setting watch fd -1 data to data = (nil) function = (nil) from data = (nil) function = (nil) [dbus/dbus-watch.c(628):dbus_watch_set_data] Setting watch fd -1 data to data = (nil) function = (nil) from data = (nil) function = (nil) [dbus/dbus-transport-socket.c(98):free_watches] end [dbus/dbus-transport.c(513):_dbus_transport_disconnect] end
I also started debug mode
, but I cannot find a way out anywhere. It's not in syslog. I may not have a debug version, but I find it unlikely that
are apparently debug options.
I tried the same experiments on the session bus with the same results.
$ dbus-daemon --version D-Bus Message Bus Daemon 1.6.8 $ cat /etc/debian_version 7.6
My ultimate goal is to use D-bus to transfer messages between computers. Getting
to work in a local case is just my first step along the way.
Update Oct 16, 2014: I was able to get this to work. The decision is counterintuitive.
There are two requirements.
You need to communicate using the SYSTEM bus . You must set the SESSION environment variable .
DBUS_SESSION_BUS_ADDRESS=tcp:host=192.168.56.101,port=10010 dbus-send --print-reply --type=method_call --dest=com.example.Test /com/example/Test com.example.Test.TestMethod string:foo
source to share
I think this is because dbus-daemon is asking for a local secret and your client doesn't know how to read it. Can you try to reset all handshake with wires? (alternatively, you can use the dbus-dissect script, but this may require some adjustments to the source code)
source to share