Dns.Resolve resolves a DNS host name or IP address to an IPHostEntry instance.
Imports System.IO
Imports System.Net
Imports System.Text
publicclass MainClass
Shared Sub Main()
Try
Dim hostInfo As IPHostEntry = Dns.Resolve("google.com")
Dim address As IPAddress() = hostInfo.AddressList
Dim [alias] As [String]() = hostInfo.Aliases
Console.WriteLine(hostInfo.HostName)
Dim index As Integer
For index = 0 To [alias].Length - 1
Console.WriteLine([alias](index))
Next index
For index = 0 To address.Length - 1
Console.WriteLine(address(index))
Next index
Catch e As Exception
Console.WriteLine("Exception caught!!!")
Console.WriteLine(("Source : " + e.Source))
Console.WriteLine(("Message : " + e.Message))
End Try
End Sub
End Class