I'm developing an application that can in some cases register a large
number of services, in the 10s or even 100s. Because I want this
application to run on Linux, OS X, and Windows, I'm using the Bonjour
API. On Linux, I use Avahi via its Bonjour compatibility layer, and
on OS X and Windows I use mDNSResponder directly.
Using the Avahi-Bonjour layer on Linux, I quickly get errors during
service registration that I eventually tracked down to the
"max_connections_per_user" limit in /etc/dbus-1/system.d/avahi-
dbus.conf (this is an Ubuntu Dapper box). This limit defaults to 20,
and it seems that every time I initialize a new DNSServiceRef (e.g.,
by registering a service), it uses one of these connections. Clearly
I can raise this limit, but that's not a great solution because all
of my users would have to do the same.
I don't have this problem running the exact same code under OS X with
- Is there a way to avoid this problem while still using the Bonjour
API? E.g., can I get the Avahi-Bonjour layer to reuse its dbus
client connection somehow?
- If I move to the native Avahi API, will I have a similar problem
with a single process that registers many services?
- Independent of the Zeroconf implementation that's being used, are
there drawbacks in general to registering and browsing large numbers