Delphi DLL
Delphi DLL
DNS Lookup
Do a DNS lookup to resolve a hostname to an IP address.Chilkat Delphi DLL Downloads
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Socket;
...
procedure TForm1.Button1Click(Sender: TObject);
var
socket: HCkSocket;
maxWaitMs: Integer;
ipAddr: PWideChar;
begin
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
socket := CkSocket_Create();
maxWaitMs := 10000;
ipAddr := CkSocket__dnsLookup(socket,'www.chilkatsoft.com',maxWaitMs);
if (CkSocket_getLastMethodSuccess(socket) <> True) then
begin
Memo1.Lines.Add(CkSocket__lastErrorText(socket));
Exit;
end;
Memo1.Lines.Add('IP Address: ' + ipAddr);
CkSocket_Dispose(socket);
end;