[avahi] avahi behavior question

Lennart Poettering lennart at poettering.net
Tue Jul 25 11:02:40 PDT 2006

On Wed, 12.07.06 16:37, Nicholas Andrews (tar.bz2 at gmail.com) wrote:

I am sorry for the late response. Somehow this mail got lost in my

> I've skimmed through the mDNS-SD internet draft but I would appreciate some
> clarification on avahi's behavior with hosts that appear and disappear on
> the network.
> Here is what I've observed with two machines, 1 avahi-core publishing a
> service and 1 avahi-client browsing for them:

May I ask in what application you plan to use the avahi-core publisher?

>   - If I register a service on one machine then browse on another with
>   avahi_service_browser_new, I can discover and resolve that service.
>   - If I first launch avahi_service_browser_new with a threaded_poll,
>   then register a service on the other machine, it doesn't seem to
>   find it.

Have you started the threaded poll correctly? (avahi_threaded_poll_start())

>   - If after discovering the service, I close the avahi-client browser,
>   then close the avahi-core publisher and the service it's providing, the 
>   next
>   time I open the avahi-client browser it finds AND resolves the service 
>   (but
>   obviously fails to connect to the service I'm advertising).

You have to shutdown the avahi_core object cleanly with
avahi_server_free(). Otherwise no "goodbye" packets are sent to the
multicast group, and thus the entries are not removed from remote

> I'd like to know 1) how do you browse such that new advertisements are
> discovered as they appear and 2) how do you stop the caching that seems to
> be going on in the third case.

1) This should work if the main loop is working properly. Please make
sure that the background thread is running and that the mainloop
object isn't locked.

2) By destructing the AvahiServer object cleanly, with
   avahi_server_free() (and all AvahiSEntryGroup objects before that)


Lennart Poettering; lennart [at] poettering [dot] net
ICQ# 11060553; GPG 0x1A015CC4; http://0pointer.net/lennart/

More information about the avahi mailing list