I cannot find any simple examples of a DNS lookup using Indy 10's TIdDNSResolver
component. They're all either for something I don't need (such as MX/SMTP), or are talking terms with no code. I have tried reading the result based on the few resources I can find, but don't know how I'm supposed to be reading the result.
Here's what I have so far...
uses
IdBaseComponent, IdComponent, IdTCPConnection, IdDNSResolver;
function TForm1.Lookup(const Name: String): String;
var
X: Integer;
begin
//DNS: TIdDNSResolver
DNS.QueryType:= [qtA];
DNS.Resolve(Name);
for X:= 0 to DNS.QueryResult.Count-1 do begin
if DNS.QueryResult[X].RecType = qtA then
//Result:= DNS.QueryResult[X].RData; <--- ????
end;
end;
usage...
HostIP:= Lookup('www.google.com');
How do I read this response?