This CSharp (C#) code snippet shows how to get the IP address of the machine.

 

private void ListIPAddresses()
{
    IPHostEntry myIPHostEntry = Dns.GetHostEntry(Dns.GetHostName());

    foreach (IPAddress myIPAddress in myIPHostEntry.AddressList)
    {
        Console.WriteLine(myIPAddress.ToString());    
    }
}
This website is making use of cookies for website analysis. Data is collected anonymously and solely for the purpose of improving the website. Do you agree to the use of cross-session cookies?