IPAddress.AddressFamily プロパティ

定義

IP アドレスのアドレス ファミリを取得します。

public:
 property System::Net::Sockets::AddressFamily AddressFamily { System::Net::Sockets::AddressFamily get(); };
public System.Net.Sockets.AddressFamily AddressFamily { get; }
member this.AddressFamily : System.Net.Sockets.AddressFamily
Public ReadOnly Property AddressFamily As AddressFamily

プロパティ値

AddressFamily

IPv4 の場合は InterNetwork、IPv6 の場合は InterNetworkV6 を返します。

クラス トピックの例を IPAddress 参照してください。

// Display the type of address family supported by the server. If the
// server is IPv6-enabled this value is: InterNetworkV6. If the server
// is also IPv4-enabled there will be an additional value of InterNetwork.
Console::WriteLine( "AddressFamily: {0}", curAdd->AddressFamily );

// Display the ScopeId property in case of IPV6 addresses.
if ( curAdd->AddressFamily.ToString() == ProtocolFamily::InterNetworkV6.ToString() )
         Console::WriteLine( "Scope Id: {0}", curAdd->ScopeId );

// Display the type of address family supported by the server. If the
// server is IPv6-enabled this value is: InterNetworkV6. If the server
// is also IPv4-enabled there will be an additional value of InterNetwork.
Console.WriteLine("AddressFamily: " + curAdd.AddressFamily.ToString());

// Display the ScopeId property in case of IPV6 addresses.
if(curAdd.AddressFamily.ToString() == ProtocolFamily.InterNetworkV6.ToString())
  Console.WriteLine("Scope Id: " + curAdd.ScopeId.ToString());
' Display the type of address family supported by the server. If the
' server is IPv6-enabled this value is: InterNetworkV6. If the server
' is also IPv4-enabled there will be an additional value of InterNetwork.
Console.WriteLine(("AddressFamily: " + curAdd.AddressFamily.ToString()))

' Display the ScopeId property in case of IPV6 addresses.
If curAdd.AddressFamily.ToString() = ProtocolFamily.InterNetworkV6.ToString() Then
  Console.WriteLine(("Scope Id: " + curAdd.ScopeId.ToString()))
End If

適用対象