Partilhar via


IPAddress.IPv6None Campo

Definição

Fornece um endereço IP que indica que nenhum adaptador de rede deve ser usado. Esta propriedade é somente para leitura.

public: static initonly System::Net::IPAddress ^ IPv6None;
public static readonly System.Net.IPAddress IPv6None;
 staticval mutable IPv6None : System.Net.IPAddress
Public Shared ReadOnly IPv6None As IPAddress 

Valor do campo

Exemplos

O exemplo de código a seguir exibe o valor do endereço None do host atual no formato compactado padrão.

// This method displays the value of the current host's None address in
// standard compressed format. The None address is used by the host to disable
// listening to client activities on all the interfaces.
void displayIPv6NoneAddress()
{
   try
   {
      // Get the None address.
      IPAddress^ none = IPAddress::IPv6None;
      
      // Transform the None address to a string using the overloaded
      // ToString() method. Note that the resulting string is in the compact
      // form: "::".
      String^ ipv6None = none->ToString();

      Console::WriteLine( "The IPv6 None address is: {0}", ipv6None );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "->Item[displayIPv6NoneAddress] Exception: {0}", e );
   }
}
// This method displays the value of the current host's None address in
// standard compressed format. The None address is used by the host to disable
// listening to client activities on all the interfaces.
private static void displayIPv6NoneAddress()
{
  try
  {

    // Get the None address.
    IPAddress none  = IPAddress.IPv6None;

    // Transform the None address to a string using the overloaded
    // ToString() method. Note that the resulting string is in the compact
    // form: "::".
    string ipv6None = none.ToString();

    Console.WriteLine("The IPv6 None address is: " + ipv6None);
  }
  catch (Exception e)
  {
    Console.WriteLine("[displayIPv6NoneAddress] Exception: " + e.ToString());
  }
}
' This function prints the value of the current host's None address in  
' standard compressed format. The None address is used by the host to disable
' listening to client activities on all the interfaces.
Private Shared Sub printIPv6NoneAddress()
   Try
      
      ' Get the None address.
      Dim none As IPAddress = IPAddress.IPv6None
      
      ' Transform the None address to a string using the overloaded
      ' ToString() method. Note that the resulting string is in the compact 
      ' form: "::".
      Dim ipv6None As String = none.ToString()
      
      Console.WriteLine(("The IPv6 None address is: " + ipv6None))
   Catch e As Exception
      Console.WriteLine(("[printIPv6NoneAddress] Exception: " + e.ToString()))
   End Try
End Sub

Comentários

O Socket.Bind método usa o IPv6None campo para indicar que um Socket não deve escutar a atividade do cliente. O IPv6None campo é equivalente a 0:0:0:0:0:0:0:0 na notação hexadecimal de dois-pontos ou a ::0 na notação compacta.

Aplica-se a