Export (0) Print
Expand All

IPEndPoint.AddressFamily Property

Gets the Internet Protocol (IP) address family.

[Visual Basic]
Overrides Public ReadOnly Property AddressFamily As AddressFamily
[C#]
public override AddressFamily AddressFamily {get;}
[C++]
public: __property AddressFamily get_AddressFamily();
[JScript]
public override function get AddressFamily() : AddressFamily;

Property Value

Returns AddressFamily.InterNetwork.

Example

[Visual Basic, C#, C++] The following example uses the AddressFamily property to return the AddressFamily to which the IPEndPoint belongs. In this case it is the InterNetwork AddressFamily.

[Visual Basic] 
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 'displayEndpointInfo


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

[C++] 
void displayEndpointInfo(IPEndPoint* endpoint)
{
   Console::WriteLine(S"Endpoint->Address : {0}", endpoint->Address);
   Console::WriteLine(S"Endpoint->AddressFamily : {0}", __box(endpoint->AddressFamily));
   Console::WriteLine(S"Endpoint->Port : {0}", __box(endpoint->Port));
   Console::WriteLine(S"Endpoint.ToString() : {0}", endpoint);

   Console::WriteLine(S"Press any key to continue.");
   Console::ReadLine();
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

IPEndPoint Class | IPEndPoint Members | System.Net Namespace | EndPoint

Show:
© 2014 Microsoft