Windows 如何知道如何解析 mDNS 查询?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8659638/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:45:14  来源:igfitidea点击:

How does Windows know how to resolve mDNS queries?

windowsdnsbonjourresolvermdns

提问by SofaKng

When you install Bonjour for Windows you can resolve any ".local" mDNS name from anywhere in the system.

当您为 Windows 安装 Bonjour 时,您可以从系统中的任何位置解析任何“.local”mDNS 名称。

For example, you can "ping some_computer.local" and mDNSResponder.exe (Bonjour/mDNS Daemon) will respond.

例如,您可以“ping some_computer.local”并且 mDNSResponder.exe(Bonjour/mDNS Daemon)将响应。

However, mDNS operates on port 5353 so how does Windows know how to resolve these DNS queries?

但是,mDNS 在端口 5353 上运行,那么 Windows 怎么知道如何解析这些 DNS 查询呢?

Is mDNSResponder.exe hooking into the Windows DNS Resolver somehow?

mDNSResponder.exe 是否以某种方式连接到 Windows DNS 解析器?

回答by SimonJ

Bonjour for Windows allows any software using the standard name resolution APIs to resolve mDNS names; it does so by registering a DLL (mdnsnsp.dll) as a namespace providerusing WSCInstallNameSpace.

Bonjour for Windows 允许任何使用标准名称解析 API 的软件来解析 mDNS 名称;它通过使用WSCInstallNameSpace将 DLL (mdnsnsp.dll) 注册为命名空间提供程序实现

The corresponding code is included in the mDNSResponder source(in particular, look at the mdnsNSPand NSPToolcomponents).

相应的代码包含在mDNSResponder 源代码中(特别是查看mdnsNSPNSPTool组件)。