IP adresa podľa mena
Spôsob ako urobiť jednoduchý nslookup v Delphi.
uses WinSock; function GetIpAddressByName(const AComputerName: string): string; var TMPResult: string; WSA: TWSAData; H: PHostEnt; P: PChar; begin if WSAStartUp($101, WSA) = 0 then begin GetMem(P,255 + 1); StrPCopy(P, AComputerName); H:=GetHostByName(P); FreeMem(P); if H <> nil then begin P:=inet_ntoa(PInAddr(H^.h_addr_list^)^); TMPResult:=StrPas(P) end; WSACleanUp; if TMPResult <> '' then Result:=TMPResult else Result:= '0'; end; end; procedure TForm1.Button1Click(Sender: Tobject); begin Caption:=GetIpAddressByName('localhost'); end;