[avahi] Registering Service Subtype?
lennart at poettering.net
Thu Dec 11 10:15:15 PST 2008
On Wed, 05.11.08 14:55, Mark K. Gardner (mkg at vt.edu) wrote:
> Background: I am trying to make a master/worker application
> autoconfigure using zeroconf. I plan to have the master register a
> service that the workers can lookup and the workers register a service
> that the master can lookup. In this application, masters can also do
> work so I am attempting to register a base service and then
> distinguish masters from workers by using subtypes.
That is a pretty bad reason to use subtypes.
Subtypes can only be used as lookup keys. I.e. you can use them to
browse for a subset of services of a specific type. But you cannot
query all subtypes of a given service or any other query.
Just use _foo-server._tcp and _foo-client._tcp in your case.
> Would anyone please enlighten me as to what I am doing wrong?
You need to specify the full subtype, i.e. including _sub._waldo._tcp.
> Once I can register a subtype, how can I query and get all current
> services of type _demo._tcp and iterate through them all so I can do
> type specific things with each one?
There is not difference between enumerating services by type and by
subtype. You simply pass what you are looking for and you get the
response. You need to pass the full type
resp. subtype. i.e. "_foo._sub._bar._tcp" and "_bar._tcp" are
fine. Just "_foo", _foo._sub", or "_bar" is not.
Lennart Poettering Red Hat, Inc.
lennart [at] poettering [dot] net ICQ# 11060553
http://0pointer.net/lennart/ GnuPG 0x1A015CC4
More information about the avahi