This documentation is archived and is not being maintained.

IPAddress.IPv6Any Field

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

The Socket.Bind method uses the IPv6Any field to indicate that a Socket should listen for client activity on all network interfaces.

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

Remarks

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

Example

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

[Visual Basic] 
' This function prints the value of the current host's Any address in  
' standard compressed format. The Any address is used by the host to enable
' listening to client activities on all the interfaces for a given port.
Private Shared Sub printIPv6AnyAddress()
   Try
      ' Get the Any address.
      Dim any As IPAddress = IPAddress.IPv6Any
      
      ' Transform the Any address to a string using the overladed
      ' ToString() method. Note that the resulting string is in the compact 
      ' form: "::".
      Dim ipv6Any As String = any.ToString()
      
      ' Display the Any address.
      Console.WriteLine(("The IPv6 Any address is: " + ipv6Any))
   Catch e As Exception
      Console.WriteLine(("[printIPv6AnyAddress] Exception: " + e.ToString()))
   End Try
End Sub 'printIPv6AnyAddress


[C#] 
// This method displays the value of the current host's Any address in  
// standard compressed format. The Any address is used by the host to enable
// listening to client activities on all the interfaces for a given port.
private static void displayIPv6AnyAddress()
{
  try
  {
    // Get the Any address.
    IPAddress any = IPAddress.IPv6Any;

    // Transform the Any address to a string using the overloaded
    // ToString() method. Note that the resulting string is in the compact 
    // form: "::".
    string ipv6Any = any.ToString();
    
    // Display the Any address.
    Console.WriteLine("The IPv6 Any address is: " + ipv6Any);
  }
  catch (Exception e) 
  {
    Console.WriteLine("[displayIPv6AnyAddress] Exception: " + e.ToString());
  }
}

[C++] 
// This method displays the value of the current host's Any address in
// standard compressed format. The Any address is used by the host to enable
// listening to client activities on all the interfaces for a given port.
void displayIPv6AnyAddress() {
   try {
      // Get the Any address.
      IPAddress* any = IPAddress::IPv6Any;

      // Transform the Any address to a string using the overloaded
      // ToString() method. Note that the resulting string is in the compact
      // form: "::".
      String* ipv6Any = any->ToString();

      // Display the Any address.
      Console::WriteLine(S"The IPv6 Any address is: {0}", ipv6Any);
   } catch (Exception* e) {
      Console::WriteLine(S"->Item[displayIPv6AnyAddress] 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: