C# IPEndPoint AddressFamily

Description

IPEndPoint AddressFamily Gets the Internet Protocol (IP) address family.

Syntax

IPEndPoint.AddressFamily has the following syntax.


public override AddressFamily AddressFamily { get; }

Example

Gets the Internet Protocol (IP) address family.


/*from w ww  . j  a  va 2s.c o  m*/

using System;
using System.Net;
using System.Net.Sockets;

public class Example
{
    public static void Main()
    {
        IPAddress hostIPAddress1 = (Dns.Resolve("google.com")).AddressList[0];
        IPEndPoint endpoint = new IPEndPoint(hostIPAddress1, 80);
        Console.WriteLine("Endpoint.Address : " + endpoint.Address);
        Console.WriteLine("Endpoint.AddressFamily : " + endpoint.AddressFamily);
        Console.WriteLine("Endpoint.Port : " + endpoint.Port);
        Console.WriteLine("Endpoint.ToString() : " + endpoint.ToString());
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Net »




Cookie
Dns
IPAddress
IPEndPoint
IPHostEntry
WebClient