| 发表于:2008-02-15 14:01:257楼 得分:0 |
我使用域名转ip的方法实现的。 public function getip(strremotehostip as string) as string dim hostent_addr as long dim host as hostent dim hostip_addr as long dim temp_ip_address() as byte dim i as integer dim ip_address as string hostent_addr = gethostbyname(strremotehostip) if hostent_addr = 0 then getip = "" ' 注释:主机名不能被解释 exit function end if rtlmovememory host, hostent_addr, lenb(host) rtlmovememory hostip_addr, host.haddrlist, 4 redim temp_ip_address(1 to host.hlength) rtlmovememory temp_ip_address(1), hostip_addr, host.hlength for i = 1 to host.hlength ip_address = ip_address & temp_ip_address(i) & "." next ip_address = mid$(ip_address, 1, len(ip_address) - 1) getip = ip_address end function 使用方法: if text1.text <> "" then wskclient.remotehost = getip(strremotehostip) if text2.text <> "" then wskclient.remoteport = text2.text | | |
|