Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IPAddress.IPv6Any Field

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

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

'Declaration
Public Shared ReadOnly IPv6Any As IPAddress
'Usage
Dim value As IPAddress 

value = IPAddress.IPv6Any

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

The following code example displays the value of the current host's Any address in standard compressed format.

' 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
// 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);
   }
}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1

.NET Compact Framework

Supported in: 3.5, 2.0

Community Additions

ADD
Show:
© 2015 Microsoft