IPAddress.AddressFamily Propriedade

Definição

Obtém a família de endereços do endereço 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

Valor da propriedade

Retorna InterNetwork para IPv4 ou InterNetworkV6 para IPv6.

Exemplos

Consulte o exemplo no tópico de IPAddress classe.

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

Aplica-se a