Main >
Code Central >
VB.NET
Find your IP Address
ID: 1038
Author: Abstractvb.com
Date: 5/11/2002 10:43:54 PM
VB.NEt To find your IP address we first ask for your machine name, then we pass that to the GetHostName function that gives us a valid IPHostEntry object. This object contains your IP address in the AddressList array, so we just dump the value to the console.
Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName)
Console.WriteLine(CType(h.AddressList.GetValue(0), IPAddress).ToString)