共用方式為


IPAddress.IPv6None 欄位

定義

提供 IP 位址,表示不可使用網路介面。 這個屬性是唯讀的。

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 

欄位值

範例

下列程式代碼範例會以標準壓縮格式顯示目前主機的 None 位址值。

// 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

備註

方法 Socket.BindIPv6None 使用欄位來 Socket 表示 不得接聽客戶端活動。 欄位 IPv6None 相當於 0:0:0:0:0:0:0:0:0,以冒號十六進位表示法表示,或等於 ::0。

適用於