本文整理自网络,侵删。
function procedure TForm1.nametoip(name:string):string;
var
WSAData: TWSAData;
HostEnt: PHostEnt;
begin
result:='';
WSAStartup(2, WSAData);
HostEnt := gethostbyname(PChar(name));
if HostEnt <> nil then
begin
with HostEnt^ do
result:= Format('%d.%d.%d.%d', [Byte(h_addr^[0]), Byte(h_addr^[1]), Byte(h_addr^
[2]), Byte(h_addr^[3])]);
end;
WSACleanup;
end;
相关阅读 >>
Delphi idftp 错误:socket error 10054 �c connection reset by peer -连接被重置
Delphi tfinddialog treplacedialog对话框在memo中的使用
Delphi 使用tmemorystream保存多张图片到文件,并读取
更多相关阅读请进入《Delphi》频道 >>