[avahi] Announce Service for another Computer

Lennart Poettering lennart at poettering.net
Fri May 14 10:19:54 PDT 2010

On Fri, 14.05.10 16:03, Jens Dede (ietf at jdede.de) wrote:

> Is it possible to announce a service for another computer which name is
> not resolvable via DNS or mDNS?
> I like to use python with dbus.
> bus = dbus.SystemBus()
> server = dbus.Interface(
>    bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER),
>         avahi.DBUS_INTERFACE_SERVER)
> g = dbus.Interface(
>           bus.get_object(avahi.DBUS_NAME,
>                          server.EntryGroupNew()),
>             avahi.DBUS_INTERFACE_ENTRY_GROUP)
> g.AddService(avahi.IF_UNSPEC, avahi.PROTO_INET6, dbus.UInt32(0),
>             self.name, self.stype, self.domain, self.host,
>             dbus.UInt16(self.port), self.text)
> g.commit()
> If I set self.host to an IP(v6)-Address or an unresolvable name I get an
> error message. self.host = "" uses my hostname to publish the service.
> How can I announce a service for any address / host?

You must specifiy a proper hostname when registering a service. That
means you might need to register both a host name and a service if you
want to publish a remote service on a machine that lacks any kind of DNS


Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

More information about the avahi mailing list