简体   繁体   English

DNS在传输层使用UDP协议时如何可靠?

[英]How is DNS reliable when it uses UDP protocol at transport layer?

I have searched the same and got something like this: 我已经搜索了相同的东西,并得到了这样的东西:

"An application can use UDP and can be reliable by using timeout and resend at application layer." “应用程序可以使用UDP,并且可以通过使用超时来使其可靠并在应用程序层重新发送。”

Does reliability only means sending acknowledgments and what about identifying corrupted/duplicate packets? 可靠性是否仅意味着发送确认以及如何识别损坏/重复的数据包? Can anybody explain me the depth of this. 谁能解释这个问题的深度。

UDP not being reliable means that UDP does not care itself that the packet is received by the peer, ordering of packets, duplicates etc. UDP不可靠意味着UDP并不关心对等方已接收到数据包,数据包的顺序,重复项等。

But, an application layer protocol can itself care about this and does not need to rely on the reliability of the lower layer. 但是,应用程序层协议本身可以解决此问题,而不必依赖于较低层的可靠性。 In case of DNS each request should lead to exactly one response and receiving the response is implicitly the acknowledgment that the request was received. 在DNS的情况下,每个请求应恰好导致一个响应,并且接收到该响应暗含了对已接收到请求的确认。 Also a DNS request and response each fit into a single UDP packet - so reordering does not matter. 另外,DNS请求和响应都适合单个UDP数据包-因此重新排序并不重要。 Each UDP request has a unique combination of ID and source port and the response packet contains the same ID and port - so it is clear which response belongs to which query. 每个UDP请求都有ID和源端口的唯一组合,并且响应数据包包含相同的ID和端口-因此很清楚哪个响应属于哪个查询。 And if a response is not received within some time it will assume that it either the request or the response are lost and simply retry with a new query. 并且,如果在一段时间内未收到响应,则将假定该请求或响应都丢失了,只需使用新查询重试即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM