远程控制篇:通过IP地址得到机器名 (转)[@more@]
function iptoname(ip:string):string;
var
WSAData:TWSAData;
p:PHostEnt;
.NETAddr:dword;
begin
WSAStartup(2, WSAData);
InetAddr:= inet_addr(PChar(IP));
try
p:=GetHostByAddr(@InetAddr, Length(IP), PF_Inet);
result:=p^.h_name;
except
result:=';
end;
end;
官本和 2001.4
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752043/viewspace-988204/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10752043/viewspace-988204/
本文提供了一段Delphi代码示例,演示了如何通过IP地址获取对应的机器名称。该方法利用了Windows Socket API中的GetHostByAddr函数实现。
866

被折叠的 条评论
为什么被折叠?



