I've attempted to follow the documentation provided on TDNSSend, but I can't
seem to find a working (or not working) example of how to use TDNSSend.

I'm using BDS 2006 (Delphi 10/2006)

Here is how I interpreted it should work:
Note: DNSQuery *always* returns false, and DNSReply never gets populated.

procedure TForm1.Button1Click(Sender: TObject);
var Resolver: TDNSSend;
    DNSReply: TStringList;
    DNSError: String;
begin
  DNSReply := TStringList.Create;
  Resolver := TDNSSend.Create;
  try
    if Resolver.DNSQuery(Edit1.Text, QTYPE_AAAA, DNSReply) then begin
      Edit1.Text := DNSReply.Strings[0];
    end
    else begin
      if Resolver.RCode = 0 then DNSError := 'No error'
      else if Resolver.RCode = 1 then DNSError := 'Format error'
      else if Resolver.RCode = 2 then DNSError := 'Server failure'
      else if Resolver.RCode = 3 then DNSError := 'Name error'
      else if Resolver.RCode = 4 then DNSError := 'Not implemented'
      else if Resolver.RCode = 5 then DNSError := 'Refused'
      else DNSError := 'Unknown error!';
      MessageDlg(Edit1.Text+' does not resolve to a valid IPv6 (AAAA)
address.'+#10#13#10#13+'If there was an error in the query, it would be
here:'+#10#13+DNSError, mtError, [mbOK], 0);
    end;
  finally
    Resolver.Free;
    DNSReply.Free;
  end;
end;

--
Kindest Regards,
Josh Finlay 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to