Delphi ActiveX
Delphi ActiveX
DNS Lookup
Do a DNS lookup to resolve a hostname to an IP address.Chilkat Delphi ActiveX Downloads
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;
...
procedure TForm1.Button1Click(Sender: TObject);
var
socket: TChilkatSocket;
maxWaitMs: Integer;
ipAddr: WideString;
begin
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
socket := TChilkatSocket.Create(Self);
maxWaitMs := 10000;
ipAddr := socket.DnsLookup('www.chilkatsoft.com',maxWaitMs);
if (socket.LastMethodSuccess <> 1) then
begin
Memo1.Lines.Add(socket.LastErrorText);
Exit;
end;
Memo1.Lines.Add('IP Address: ' + ipAddr);
end;