Standard mDNS service on Windows

2019-03-14 14:28发布

问题:

Does Windows (some modern flavour) have an mDNS server installed and/or running by default? If so then how does one tell it, preferably dynamically, to start/stop advertising a new service?

If there is no standard then how does one deal with the problem of conflicts trying to run multiple mDNS servers in that environment?

Basically, I want to implement a service that will run on Linux, Windows and Mac OS X and which needs to advertise its zeroconf webserver location using mDNS. On Linux I just use avahi-publish (or install a config file). I'm guessing that the answer will be straightforward for OS X. I'm struggling to find information for Windows.

回答1:

No, Microsoft doesn't directly support Multicast-DNS.

However, there appear to be several 3rd-party alternatives:

  • http://bens.me.uk/2013/multicast-dns-and-development-virtual-machines

  • http://en.wikipedia.org/wiki/Bonjour_%28software%29

  • http://www.icir.org/gregor/tools/autoconf-protocols.html

  • http://www.zeroconf.org/

    ... and ...

  • http://blogs.technet.com/b/networking/archive/2008/04/01/how-to-benefit-from-link-local-multicast-name-resolution.aspx



回答2:

Starting with Windows 10, Microsoft seems to make strides towards a native Windows implementation of mDNS and dns-sd.

Their first iteration resulted in mDNS network flooding:

Windows 10, in its default configuration, will spam its local networks by responding to all mDNS requests with null response packets.

And following up:

This issue was fixed in Windows 10 1511 (10586) and above

Recent builds have seen improvements all over the place and Windows now offers a dns-sd service discovery library which is currently limited to UWP apps.



回答3:

Last time I needed one, Apple's Bonjour Print Services for Windows was the most convenient mDNS client for Windows I could find. Only 5MB.



回答4:

The short answer is to support both Avahi and Bonjour. You'll need Bonjour support to run on OSX anyway, and if a Windows user has installed iTunes they'll already be running it.

As a fallback for Windows users not running iTunes, you can compile Avahi as a library for Windows (with a bit of effort) and bundle it. This is a non-trivial bit of packaging, but the alternative is requiring your Windows users to install iTunes in order to use your application.



标签: mdns