Delphi indy IdDNSResolver does not return all requested DNS results

Based on the documentation, I can add more than one type of query in the search, but the result will always be only 1 type.

For example, I set id.QueryType: = [qtNS, qtA, qtMX]; and I only get the record A. Extracting qtA, I get 3 NS records back, but not MX. Each one of them works great.

Example:

id:=TIdDNSResolver.Create(nil); id.Host:='8.8.8.8'; id.QueryType:='[qtNS, qtA, qtMX]; id.Resolve('car.com'); ... 

id.QueryResult.count is only 1, and it contains only the A record.

So how can I get all 3 types in 1 query?

+6
source share
1 answer

DNS queries are described in RFC 1035 . According to this document, sending multiple questions to the same request is allowed, I assume that it is implemented in this way in Indy.

In practice, DNS servers usually do not support this, and return only one answer, even if there are several questions. You can find more information in this post , and posts related to it.

I would suggest that DNS servers answer the first question, so if you pass an array with multiple types, you can expect an answer for the type with the lowest id. In your case, the priority will be qtA > qtNS > qtMX . If you need answers for everyone, you must solve them separately.

+2
source

Source: https://habr.com/ru/post/1014693/


All Articles