This documentation is archived and is not being maintained.

IPAddress.IPv6Loopback Field

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Provides the IP loopback address. This property is read-only.

[Visual Basic]
Public Shared ReadOnly IPv6Loopback As IPAddress
[C#]
public static readonly IPAddress IPv6Loopback;
[C++]
public: static IPAddress* IPv6Loopback;
[JScript]
public static var IPv6Loopback : IPAddress;

Remarks

The IPv6Loopback field is equivalent to 0:0:0:0:0:0:0:1 in colon-hexadecimal notation, or to::1 in compact notation.

Example

[Visual Basic, C#, C++] The following code example displays the value of the current host's loopback address in standard compressed format.

[Visual Basic] 
' This methods prints the value of the current host loopback address in  
' standard compressed format. 
Private Shared Sub printIPv6LoopBackAddress()
   Try
      ' Get the loopback address.
      Dim loopBack As IPAddress = IPAddress.IPv6Loopback
      
      ' Transform the loop-back address to a string using the overloaded
      ' ToString() method. Note that the resulting string is in the compact 
      ' form: "::1".
      Dim ipv6LoopBack As String = loopBack.ToString()
      Console.WriteLine(("The IPv6 Loopback address is: " + ipv6LoopBack))
   Catch e As Exception
      Console.WriteLine(("[printIPv6LoopBackAddress] Exception: " + e.ToString()))
   End Try
End Sub 'printIPv6LoopBackAddress


[C#] 
// This method displays the value of the current host loopback address in  
// standard compressed format. 
private static void displayIPv6LoopBackAddress()
{
  try
  { 
    // Get the loopback address.
    IPAddress loopBack = IPAddress.IPv6Loopback;

    // Transform the loop-back address to a string using the overladed
    // ToString() method. Note that the resulting string is in the compact 
    // form: "::1".
    string ipv6LoopBack = loopBack.ToString();
    Console.WriteLine("The IPv6 Loopback address is: " + ipv6LoopBack);
  }
  catch (Exception e) 
  {
    Console.WriteLine("[displayIPv6LoopBackAddress] Exception: " + e.ToString());
  }
}

[C++] 
// This method displays the value of the current host loopback address in
// standard compressed format.
void displayIPv6LoopBackAddress() {
   try {
      // Get the loopback address.
      IPAddress* loopBack = IPAddress::IPv6Loopback;

      // Transform the loop-back address to a string using the overladed
      // ToString() method. Note that the resulting string is in the compact
      // form: "::1".
      String* ipv6LoopBack = loopBack->ToString();
      Console::WriteLine(S"The IPv6 Loopback address is: {0}", ipv6LoopBack);
   } catch (Exception* e) {
      Console::WriteLine(S"->Item[displayIPv6LoopBackAddress] Exception: {0}", e);
   }
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

IPAddress Class | IPAddress Members | System.Net Namespace

Show: