using System;
using System.Net;
class Program {
static void Main(string[] args)
{
// IP Port 예제
// IPv4
IPAddress a1 = new IPAddress(new byte[] { 101, 102, 103, 104 });
Console.WriteLine(a1); // 101.102.103.104
IPAddress a2 = IPAddress.Parse("101.102.103.104");
Console.WriteLine(a1.Equals(a2)); // True
Console.WriteLine(a2.AddressFamily); // InterNetwork
// IPv6 0000:0000:0000:0000:0000:0000:0000:0000 ~ FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 이며, 이는 결국(16x16x16x16)8 = 65,5368개가 된다.
IPAddress a3 = IPAddress.Parse("[3EA0:FFFF:198A:E4A3:4FF2:54FA:41BC:8D31]");
Console.WriteLine(a3); // 3ea0:ffff:198a:e4a3:4ff2:54fa:41bc:8d31
Console.WriteLine(a3.AddressFamily); // InterNetworkV6
IPEndPoint ep = new IPEndPoint(a2, 222);
Console.WriteLine(ep.ToString()); // 101.102.103.104:222
}
}