次の方法で共有


IPAddress.IPv6None フィールド

メモ : この名前空間、クラス、およびメンバは、.NET Framework Version 1.1 だけでサポートされています。

IP アドレスを提供し、ネットワーク インターフェイスを使用しないことを示します。このプロパティは読み取り専用です。

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

解説

Socket.Bind メソッドは、 IPv6None フィールドを使用して、 Socket がクライアントによるネットワーク利用を待機する必要がないことを示します。 IPv6None フィールドは、コロン区切りの 16 進表記 0:0:0:0:0:0:0:0 と等しくなります。簡単な表記では::0 になります。

使用例

[Visual Basic, C#, C++] 標準の圧縮形式で現在のホストのどのアドレスの値も表示しない例を示します。

 
' 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 'printIPv6NoneAddress


[C#] 
// 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());
  }
}

[C++] 
// 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(S"The IPv6 None address is: {0}", ipv6None);
   } catch (Exception* e) {
      Console::WriteLine(S"->Item[displayIPv6NoneAddress] Exception: {0}", e);
   }
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

IPAddress クラス | IPAddress メンバ | System.Net 名前空間