
What I want: a (open-source, OS-portable) way to advertise my game on a local LAN, so local players can play with each other easily ("Zeroconf networking"). It looks like MDNS/DNS-SD is the most sensible choice; but it needs (or greatly benefits from) interfacing with whatever the system is running (e.g. Avahi on Linux, and I guess Bonjour on Mac, and I'm not sure quite how people manage to use it on Windows). My current networking is based on Boost.Asio, which I'm pretty happy with as a socket library (yay! finally learning how to use sockets!). Does this MDNS/DNS-SD need support from Boost.Asio, or else what's a good way to go about using it? Maybe to use Bonjour's interface because Avahi apparently implements a compatibility layer for that? (P.S. Although the actually-asynchronous IO was a little confusing. With my Haskell background, I eventually realized that many of the examples were highly obfuscated versions of lambda functions (continuations) defined within other functions, because C++ doesn't yet support such things.) -Isaac

I know a bit about mDNS, and I think DNS-SD is just a way to implement service discovery on top of DNS. The lookup part of mDNS should be implemented at the system level. On a posix system w/ mDNS support, the lookup is normally handled transparently via gethostbyname() and therefore requires no special support from ASIO. Two ways I've seen this done are via custom support in the C library and via a plug-in (specifically, a shared library that's specified via /etc/nsswitch.conf). For scalability reasons, it is ideal if the lookup consults a daemon process or service running on the local machine that can both listen for announcements and maintain a cache from which to answer duplicate queries. I think the Windows install of Bonjour has a way of extending the normal DNS lookup mechanism to support mDNS, as well. This is necessary for use of mDNS from Windows XP, as it lacks built-in support. I can't say the same for Windows Vista, however. I'm not familiar with the other side (i.e. announcements), but I wonder whether typical OS security models permit this to be done at the application level (i.e. if the user is not running as root or local Administrator). If that's the case, then your app would have to communicate with a service which supports mDNS announcements for that platform - and I'm pretty sure there's no standard way to do that. You might find more interest, on the asio-users mailing list: http://sourceforge.net/mail/?group_id=122478 Matt

As the implementer of wxDNSSD (Bonjour for wxWidgets), I can pretty easily state that Bonjour doesn't need any access to your actual socket at all. Also, since it uses port 5353, Administrator/root access is also not needed. Because this is wholly independent of your actual socket, you can advertise services on any port, whether they actually exist or not. I have learned that iTunes--which does not *require* Bonjour be installed--is statically linked to Bonjour. If Bonjour is installed, it uses the installed mDNS responder. If not, it runs its own. http://wxcode.sourceforge.net/complist.php?compperpage=1000&viewmode=full&browseby=category§ion=networking&page=1 http://trac.wxwidgets.org/ticket/9777 ------------------------------- Hank Schultz Cedrus Corporation http://www.cedrus.com/ On Aug 3, 2008, at 11:40 PM, Matt Gruenke wrote:
I know a bit about mDNS, and I think DNS-SD is just a way to implement service discovery on top of DNS.
The lookup part of mDNS should be implemented at the system level. On a posix system w/ mDNS support, the lookup is normally handled transparently via gethostbyname() and therefore requires no special support from ASIO. Two ways I've seen this done are via custom support in the C library and via a plug-in (specifically, a shared library that's specified via /etc/nsswitch.conf). For scalability reasons, it is ideal if the lookup consults a daemon process or service running on the local machine that can both listen for announcements and maintain a cache from which to answer duplicate queries.
I think the Windows install of Bonjour has a way of extending the normal DNS lookup mechanism to support mDNS, as well. This is necessary for use of mDNS from Windows XP, as it lacks built-in support. I can't say the same for Windows Vista, however.
I'm not familiar with the other side (i.e. announcements), but I wonder whether typical OS security models permit this to be done at the application level (i.e. if the user is not running as root or local Administrator). If that's the case, then your app would have to communicate with a service which supports mDNS announcements for that platform - and I'm pretty sure there's no standard way to do that.
You might find more interest, on the asio-users mailing list:
http://sourceforge.net/mail/?group_id=122478
Matt
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Isaac Dupree
-
Matt Gruenke
-
William H. Schultz