jmdns 常量
我已经使用 JmDNS 一段时间了。我可以将它用于我的应用程序。一切对我来说都很好(我有“播音员”机器和“监听”机器,后一台机器可以看到其他设备并发现它们的信息)。
确实,我已经成功地使用了 JmDNS jar 文件,但我并没有完全理解该文件中发生的情况。现在我想了解一下使用JmDNS对网络流量的影响。我查阅了文档,但无法找到常量的含义,例如QUERY_WAIT_INTERVAL
、PROBE_THROTTLE_COUNT
等。
我想知道播音员的默认频率机器发送服务公告。
我还注意到 DNS_TTL 的描述如下:“默认 TTL 按标准设置为 1 小时,因此记录将在任何侦听计算机的缓存中保留一个小时,而无需再次 ping 服务器”。
我知道这是服务保留在 DNS 缓存中的生存时间,但我无法理解“清除服务器”的含义。这是否意味着当 DNS_TTL 过期时,监听者必须向播音员询问服务?如果是这样,为什么需要让播音员每 1 秒(ANNOUNCE_WAIT_INTERVAL
= 1000 毫秒)宣布其服务?
我很困惑。
I have been using JmDNSfor a while now. I could use it for the purposes of my application. Every thing works fine for me (I have "announcer" machines and a "listening" one, and this latter machine can see the other devices and discover their information).
It is true that I've managed to work with the JmDNS jar file, but I did it without totally understanding what is going on in this file. Now I want to know about the effect of using JmDNS for the network traffic. I have consulted the documentation but couldn't manage to discover the signification of the constants, like QUERY_WAIT_INTERVAL
, PROBE_THROTTLE_COUNT
, etc.
I want to know the default frequency with which the announcer machine sends service announcements.
I also noticed DNS_TTL that was described as follows: "The default TTL is set to 1 hour by the standard, so a record is going to stay in the cache of any listening machine for an hour without need to ping the server again".
I understand that it is the Time To Live of the service to stay in the DNS cache, but I couldn't understand what is intended by "purge the server". Does it mean that the listener has to ask the announcer about a service when the DNS_TTL expires? if so, why do need to have the announcer announce its service every 1s (ANNOUNCE_WAIT_INTERVAL
= 1000 milliseconds)?
I am so confused.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
域名系统的工作方式基本上非常简单。从根本上来说,它是一个从根名称服务器开始的树状系统。然后,它们将名称空间委托给下一个级别。该级别又代表下一个级别,依此类推。例如,
.
是根,它委托给.com.
,然后可以委托出example.com.
。 (是的,后面的.
实际上是域名的一部分,尽管您几乎不需要使用它或看到它。当您加载网页时,通常会加载数百个元素。这是每个图像、每个
JS
文件、每个CSS
文件等。如果让您的计算机对一个页面多次请求相同的域进行 IP 解析,则会导致加载时间难以忍受,并且因此也会在名称服务器上产生大量不必要的流量。DNS
缓存。TTL
是缓存的时间,如果设置为 24 小时,那么当您得到该解析的答案时,这就是您可以保留的时间。在您提出另一个请求之前,您所谈论的公告基本上是在宣布它负责这些域。您希望它不断声明,以便其他域名服务器知道到哪里获取正确的(权威的)域名。数据
限制是一个在许多领域和应用程序中使用的术语,意味着您正在限制流量,以免流量过载。
一旦了解了基础知识,
DNS
实际上就很容易理解。以下是一些可以帮助您更好地掌握所有内容的链接:
The way that the Domain Name System works is basically very simple. Fundamentally it's a tree-like system which starts with the root nameservers. These then delegate name space out to the next level. That level in turn delegates out the next level and so on. For example
.
is the root, which delegates to.com.
, which can then delegate outexample.com.
. (Yes, that trailing.
is actually part of the domain name, though you almost never have to use it or see it.When you load a web page there are usually hundreds of elements that load. This is every image, every
JS
file, everyCSS
file, etc. To have your computer request that same domain to IP resolution that many times for one page would make load time unbearable and also create massive unnecessary traffic on the nameserver. ThereforeDNS
caches. TheTTL
is how long it caches for. If it's set to 24 hours then when you get an answer for that resolution, that's how long you can hold on to it for before you make another request.The announcing that you're talking about is the nameserver basically announcing that it's responsible for those domains. You want it constantly stating that so other nameservers know where to go to get the correct (authoritative) data.
Throttling is a term used in many fields and applications and means you're limiting your traffic flow so it doesn't get overloaded.
DNS
is actually quite simple to understand once you get the basics down.Here are a few links that could help you get a better grip of it all: