C# IPAddress AddressFamily
Description
IPAddress AddressFamily
Gets the address family of the
IP address.
Syntax
IPAddress.AddressFamily
has the following syntax.
public AddressFamily AddressFamily { get; }
Example
using System;/*w w w . ja va 2 s.c o m*/
using System.Net;
using System.Net.Sockets;
public class Example
{
public static void Main()
{
IPAddress hostIPAddress = IPAddress.Parse("127.0.0.1");
if (hostIPAddress.AddressFamily.ToString() == ProtocolFamily.InterNetworkV6.ToString())
Console.WriteLine("Scope Id: " + hostIPAddress.ScopeId.ToString());
}
}