Get Host Name and IP address : Dns « Socket Network « VB.Net Tutorial






Imports System.Environment
Imports System.Net
  
Public Class Tester
    Public Shared Sub Main
        Dim hostname As String = Dns.GetHostName()
        Dim ipaddress As String = CType(Dns.GetHostByName(hostname).AddressList.GetValue(0), IPAddr
ess).ToString
        Console.WriteLine("Computer Name: " & hostname & "   IP Address: " & ipaddress)
    End Sub

End Class
Computer Name: java2s   IP Address: 192.168.1.101








22.16.Dns
22.16.1.Dns.GetHostName
22.16.2.Get IP address by domain name
22.16.3.Get Host name by address
22.16.4.Resolve domain in a thread
22.16.5.Get Host Name and IP address