Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

IPEndPoint.AddressFamily Property

Definition

Namespace:
System.Net
Assemblies:
System.dll, System.Net.Primitives.dll
Assemblies:
netstandard.dll, System.Net.Primitives.dll
Assembly:
System.Net.Primitives.dll
Assembly:
System.dll
Assembly:
netstandard.dll
Source:
IPEndPoint.cs
Source:
IPEndPoint.cs
Source:
IPEndPoint.cs
Source:
IPEndPoint.cs
Source:
IPEndPoint.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Gets the Internet Protocol (IP) address family.

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

Property Value

Returns InterNetwork.

Examples

The following example uses the AddressFamily property to return the AddressFamily to which the IPEndPoint belongs. In this case it is the InterNetworkAddressFamily.

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

Applies to

See also


Feedback

Was this page helpful?