Get IP loopback address in CSharp

Description

The following code shows how to get IP loopback address.

Example


using System;//  ww  w .  jav  a 2  s.  co  m
using System.Net;
using System.Net.Sockets;

public class Example
{
   public static void Main()
   {
        IPAddress a = IPAddress.IPv6Loopback;
    
        string ip = a.ToString();
        Console.WriteLine(ip);
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Network »




IP
Web Client