问题
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:
Windows 10 supports natively mDNS/Zeroconf, but only for modern APIs, not for Win32 applications. If you have such an application, a third party service is required.
Source: https://social.technet.microsoft.com/Forums/en-US/8a0346de-2296-4f46-bc36-ff3fb13e283b/builtin-mdnsdnssd-zeroconf-support-in-windows-10
回答5:
Have also successfully used C++/WinRT for dnssd discovery directly from C++ now. It appears from our perspective to be quicker and more reliable to query services and will let you easily install a watcher to get notifications when devices arrive etc. Of course, this is limited to versions of Windows 10 with support for C++/WinRT, which starts with 10.0.17134.0 (Windows 10, version 1803).
One caveat: We've noticed that it does not provide, nor recognise, a FQDN (trailing dot). So for a device that Bonjour OR Avahi would give an address of mydevice.local.
, Windows instead gives mydevice.local
. Attempting to ping mydevice.local.
under Windows 10 (1809) fails.
回答6:
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.
来源:https://stackoverflow.com/questions/23624525/standard-mdns-service-on-windows