'网址转换成数字IP地址
#include Once "win/winsock2.bi"
Function resolveHost(ByRef hostname as String) as Integer
   '网址转换成数字IP地址
   Dim ia as in_addr
   Dim hostentry as hostent Ptr
   Dim ip as Integer
   '' 检查它是否是一个IP地址
   ia.S_addr = inet_addr(hostname)
   If (ia.S_addr = INADDR_NONE) Then
      
      '' 如果没有，假设它是一个名字，解决它
      hostentry = gethostbyname(hostname)
      If (hostentry = 0) Then
         Exit Function
      End If
      'AfxMsg hostname & " " & Hex( hostentry)
      ip = *Cast(Integer Ptr, *hostentry->h_addr_list)
      'AfxMsg Str(ip)
      Function = ip
   Else
      '' 只是返回地址
      Function = ia.S_addr
   End If
   
End Function