IP resolution

This code sample consists of a function GetIP that gets the IP address of a domain. The function takes the domain as a String object and returns the IP as a String. This process is generally called IP resolution.

Public function GetIP(ByVal domain as String) as String

Dim Ips As New Collection
Dim i As Integer
Dim ipEntry As Net.IPHostEntry = System.Net.Dns.GetHostEntry(domain)
Dim ipAddr() As Net.IPAddress = ipEntry.AddressList
For i = 0 To ipAddr.GetUpperBound(0)
Dim AddressIP As String
return Ips(1).ToString()
Catch ex As Exception
return “Can not resolve the IP address"
End Try
end function


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: