delphi 2010 域名转换IP


本文整理自网络,侵删。

  

uses
winsock;

function GetHostIp_wwwdelphitopcom(HostName: string): string;
type
  tAddr = array[0..100] of PInAddr;
  pAddr = ^tAddr;
var
  I: Integer;
  WSA: TWSAData;
  PHE: PHostEnt;
  P: pAddr;
begin
  Result := '';

  WSAStartUp($101, WSA);
  try
  PHE := GetHostByName(pansichar(ansistring(HostName)));
  if (PHE <> nil) then
  begin
  P := pAddr(PHE^.h_addr_list);
  I := 0;
  while (P^[I] <> nil) do
  begin
  Result := (inet_nToa(P^[I]^));
  Inc(I);
  end;
  end;
  except
  end;
end;

相关阅读 >>

Delphi制作移动文字、图片

Delphi tfont类型和json互相转换的函数

Delphi 递归遍历 treeview树节点

Delphi检测本机的网络连接状态的三种方法

Delphi 双击listbox1内容,数据插入到memo1/synedit1鼠标指定位置

Delphi 7 + gdiplus 简单实现双缓冲绘制移动图形

Delphi 设置本地系统时间

Delphi unigui 获取当前ip

Delphi 2009 indy10 idhttp get 中文出现乱码的问题

Delphi 生成txt 指定带bom

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...