VB.NET Technology

VB.Net Projects

VB.Net Project 1

How to get IP Address of Websites in VB.Net application
Previous Home Next
adplus-dvertising

In VB.Net with the help of Namespace System.Net.Sockets and System.Net we can build an application through which we can find ID address of the websites.

Program code is given below

IPHostEntry - Provides a container class for internet host address information .

Dns.GetHostEntry("Hostname")- Resolve a DNS hostname or IP Address to an System.Net.IPHostEntry instance.

Imports System.Net
Imports System.Net.Sockets
Module Module1
    Sub Main()
        Dim HostName As [String]
        Console.WriteLine("Enter Web Address:")
        HostName = Console.ReadLine()
        Console.WriteLine("Looking up: {0}", HostName)
        Dim NameToIpAddress As IPHostEntry
        NameToIpAddress = Dns.GetHostEntry(HostName)
        Dim AddressCount As Integer = 0
        For Each Address As IPAddress In NameToIpAddress.AddressList
            Console.WriteLine("IP Address {0}: {1}", 
	System.Threading.Interlocked.Increment(AddressCount), Address.ToString())
        Next
        Console.ReadLine()
    End Sub
End Module
IP Address of Gmail.com
IP Address of Facebook.com
Previous Home Next