Get the Internet Protocol (IP) address family in CSharp

Description

The following code shows how to get the Internet Protocol (IP) address family.

Example


//  w w w.j a va 2  s .c  om
using System;
using System.Net;
using System.Net.Sockets;

public class Example
{
    public static void Main()
    {
        IPAddress hostIPAddress1 = IPAddress.Parse("127.0.0.1");
        IPEndPoint endpoint = new IPEndPoint(hostIPAddress1, 80);
        Console.WriteLine("Endpoint.AddressFamily : " + endpoint.AddressFamily);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Network »




IP
Web Client