IPAddress.IPv6Any Field

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Provides an IPv6 address that indicates that a server must listen for client activity on all network interfaces for IPv6. This field is read-only.

Namespace:  System.Net
Assembly:  System.Net (in System.Net.dll)

Syntax

'Declaration
Public Shared ReadOnly IPv6Any As IPAddress
public static readonly IPAddress IPv6Any

Remarks

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

The IPv6Any field is defined even when the Socket.OSSupportsIPv6 property is false.

Examples

The following code example displays the value of the current host's IPv6 Any address.

' This sample 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.
   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.
      outputBlock.Text &= "The IPv6 Any address is: "
      outputBlock.Text &= ipv6Any
      outputBlock.Text &= vbCrLf
   Catch e As Exception
      outputBlock.Text &= "Exception: "
      outputBlock.Text &= e.ToString()
      outputBlock.Text &= vbCrLf
   End Try
  // 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.
      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.
        outputBlock.Text += "The IPv6 Any address is: ";
        outputBlock.Text += ipv6Any;
        outputBlock.Text += "\n";

      }
      catch (Exception e) 
      {
        outputBlock.Text += "Exception: ";
        outputBlock.Text += e.ToString();
        outputBlock.Text += "\n";
      }

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.