delphiindyindy10

How to determine if TIdDNSResolver result are authoritative


I am using Indy's TIdDNSResolver to lookup DNS records. I have a number of DNS servers that I can try if I am not getting a result. (It is common for the first DNS server to be authoritative for local domain resources but not recursive. In this case we won't get a result and we need to try an additional server). If one of the queries is an authoritative response for the query and has no results then we don't want to continue looking up in other hosts.

Is there a way for me to tell if the response is authoritative for the query?


Solution

  • When the response is received successfully, the TIdDNSResolver.DNSHeader.AA property (Authoritative Answer) will be 1 if the answer came from an authoritative server, otherwise it will be 0.