D
duducat
Unregistered / Unconfirmed
GUEST, unregistred user!
//域名解析函数
function DNSToIP(const Host:string): string;
var
phe : PHostEnt;
InetAddr : Dword;
GInitData : TWSADATA;
begin
try
//初始化动态连接库winsock.dll
WSAStartup($101, GInitData);
InetAddr:=inet_addr(Pchar(Host));
try
phe:=GetHostByName(Pchar(Host));
InetAddr:=longint(plongint(phe^.h_addr_list^)^);
Result:=Strpas(inet_ntoa(TInaddr(InetAddr)));
except
Result:='';
end;
finally
WSACleanup;
end;
end;
function DNSToIP(const Host:string): string;
var
phe : PHostEnt;
InetAddr : Dword;
GInitData : TWSADATA;
begin
try
//初始化动态连接库winsock.dll
WSAStartup($101, GInitData);
InetAddr:=inet_addr(Pchar(Host));
try
phe:=GetHostByName(Pchar(Host));
InetAddr:=longint(plongint(phe^.h_addr_list^)^);
Result:=Strpas(inet_ntoa(TInaddr(InetAddr)));
except
Result:='';
end;
finally
WSACleanup;
end;
end;