IPEndPoint.AddressFamily 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得網際網路通訊協定 (IP) 位址家族。
public:
virtual property System::Net::Sockets::AddressFamily AddressFamily { System::Net::Sockets::AddressFamily get(); };
public override System.Net.Sockets.AddressFamily AddressFamily { get; }
member this.AddressFamily : System.Net.Sockets.AddressFamily
Public Overrides ReadOnly Property AddressFamily As AddressFamily
屬性值
傳回 InterNetwork。
範例
下列範例會 AddressFamily 使用 屬性傳回 AddressFamily 所屬的 IPEndPoint 。 在這裡情況下,它是 InterNetworkAddressFamily。
void displayEndpointInfo( IPEndPoint^ endpoint )
{
Console::WriteLine( "Endpoint->Address : {0}", endpoint->Address );
Console::WriteLine( "Endpoint->AddressFamily : {0}", endpoint->AddressFamily );
Console::WriteLine( "Endpoint->Port : {0}", endpoint->Port );
Console::WriteLine( "Endpoint.ToString() : {0}", endpoint );
Console::WriteLine( "Press any key to continue." );
Console::ReadLine();
}
private static void displayEndpointInfo(IPEndPoint endpoint)
{
Console.WriteLine("Endpoint.Address : " + endpoint.Address);
Console.WriteLine("Endpoint.AddressFamily : " + endpoint.AddressFamily);
Console.WriteLine("Endpoint.Port : " + endpoint.Port);
Console.WriteLine("Endpoint.ToString() : " + endpoint.ToString());
Console.WriteLine("Press any key to continue.");
Console.ReadLine();
}
Private Shared Sub displayEndpointInfo(ByVal endpoint As IPEndPoint)
Console.WriteLine("Endpoint Address : " + endpoint.Address.ToString())
Console.WriteLine("Endpoint AddressFamily : " + endpoint.AddressFamily.ToString())
Console.WriteLine("Endpoint Port : " + endpoint.Port.ToString())
Console.WriteLine("Endpoint ToString() : " + endpoint.ToString())
Console.WriteLine("Press any key to continue.")
Console.ReadLine()
End Sub