Description
[Note: The EndPoint class provides an abstract representation of the address of a network resource or service.]
Example
using System;
using System.Net;
using System.Net.Sockets;
public class EndPointSample
{
public static void Main()
{
IPAddress ip = IPAddress.Parse("127.0.0.1");
IPEndPoint ep = new IPEndPoint(ip, 9999);
Console.WriteLine("EndPoint.AddressFamily = '{0}'",
ep.AddressFamily);
SocketAddress sktaddr = new
SocketAddress(AddressFamily.InterNetwork);
EndPoint newep = (EndPoint)ep.Create(sktaddr);
Console.WriteLine("New EndPoint.AddressFamily = '{0}'",
newep.AddressFamily);
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Press Enter to continue");
Console.ReadLine();
}
}
The output is
EndPoint.AddressFamily = 'InterNetwork'
New EndPoint.AddressFamily = 'InterNetwork'
Press Enter to continue
|