use winsock;
数据结构定义:(msdn 2004Jan)
typedef struct hostent {
char FAR* h_name;//域名
char FAR FAR** h_aliases;//别名
short h_addrtype;//地址类型,tcp、udp是2
short h_length;//地址长度,ip是4,即4个byte型数字
char FAR FAR** h_addr_list;//数字队列,不过是以Char形式存的,Asc码值就是ip值了
} hostent;
procedure TForm1.Button2Click(Sender: TObject);
var
pho:PHostEnt;
begin
pho:=gethostbyname(PChar('im.wxbpvii.cn'));
ShowMessage(IntToStr(Byte(pho.h_addr_list^[0]))+'.'
+IntToStr(Byte(pho.h_addr_list^[1]))+'.'
+IntToStr(Byte(pho.h_addr_list^[2]))+'.'
+IntToStr(Byte(pho.h_addr_list^[3])));
end;