In the process of hacking around with dbus-monitor
, I tried connecting to the Avahi daemon:
$ dbus-monitor --system \
"type='signal',interface='org.freedesktop.Avahi.Server',member='StateChanged'"
This will respond to changes in the state of the Avahi daemon.
$ sudo restart avahi-daemon
signal sender=org.freedesktop.DBus ->
dest=:1.315
serial=2
path=/org/freedesktop/DBus;
interface=org.freedesktop.DBus;
member=NameAcquired
string ":1.315"
signal sender=:1.318 ->
dest=(null destination)
serial=4
path=/;
interface=org.freedesktop.Avahi.Server;
member=StateChanged
int32 1
string "org.freedesktop.Avahi.Success"
signal sender=:1.318 ->
dest=(null destination)
serial=13
path=/;
interface=org.freedesktop.Avahi.Server;
member=StateChanged
int32 2
string "org.freedesktop.Avahi.Success"
However, I cannot browse services like this.
$ dbus-send --system --dest=org.freedesktop.Avahi --print-reply \
/ org.freedesktop.Avahi.Server.ServiceBrowserNew \
int32:-1 int32:-1 string:'_http._tcp' string:'local' uint32:0
method return sender=:1.345 ->
dest=:1.354
reply_serial=2
object path "/Client5/ServiceBrowser1"
$ dbus-monitor --system \
"type='signal',interface='org.freedesktop.Avahi.ServiceBrowser'"
As far as I understand, this should respond to new/removed http service instances, but it does not.
Why?
Update:
Executing the equivalent of the above shell commands with the python and c APIs
worked as expected. However, they could not connect to a ServiceBrowser which I
had constructed using dbus-send
and I could not use dbus-monitor
to listen
to a ServiceBrowser they constructed.
At this point, my best guesses are:
- Once the connection is closed (by the termination of the
dbus-send
command), the ServiceBrowser I created is destroyed. However this does not explain whydbus-monitor
is unable to connect to a ServiceBrowser which is in active communication with my python script. - The signals from the ServiceBrowser are emitted only to the connection which instantiated them.