[avahi] Avahi-browse without caching
lathiat at bur.st
Thu Jul 9 06:00:39 PDT 2015
Generally speaking, it is not possible to always be sure the list is 100% current because caching is inherrent to how the protocol works to reduce traffic. Without it any moderately sized Wi-Fi network would probably fall over from the mDNS traffic. It would be a violation of the spec and terrible for your network to always run uncached queries.
You could improve this behaviour by specifically setting the TTL on the service you publish (and are thus browsing for) to be something lower than the default which suits your use case (which scales out over time to about 20 minutes by default, but when a device first connects to the network the TTL starts much smaller) — for example you could set it to 2 minutes.
Also note that if a device shuts down cleanly, it will send a goodbye and remove its records cleanly. That won’t happen for a device simply disconnected from the network by force though.
You may see somewhat improved behaviour by specifying to resolve the entries (avahi-browse -r) but ultimately the idea is that you need to verify the connection when you try to connect.
> On 9 Jun 2015, at 9:24 PM, Dominik Zäuner <hurzelchen at googlemail.com> wrote:
> I'm currently using
> avahi-browse -t --all
> to find the mDNS-capable devices that I'm looking for. But if they are disconnected after one run, the still show up in the result list.
> The manpage only shows an option to only show results from the cache but not the other way round.
> And the only way that I've found to reload avahi-daemons's cache is to restart it which requires root priviliges and I don't want to need them.
> So, is there a way to either tell avahi-browse to not show cached results or to reload the cache without needing root privileges?
> avahi mailing list
> avahi at lists.freedesktop.org
More information about the avahi