C# IPEndPoint MaxPort
Description
IPEndPoint MaxPort
Specifies the maximum value that
can be assigned to the Port property. The MaxPort value is set to 0x0000FFFF.
This field is read-only.
Syntax
IPEndPoint.MaxPort
has the following syntax.
public const int MaxPort
Example
The following example uses the MaxPort property to print the maximum value that can be assigned to the Port property.
using System;//from w ww .j ava 2s . c om
using System.Net;
using System.Net.Sockets;
public class Example
{
public static void Main()
{
IPAddress hostIPAddress1 = (Dns.Resolve("google.com")).AddressList[0];
Console.WriteLine(hostIPAddress1.ToString());
IPEndPoint hostIPEndPoint = new IPEndPoint(hostIPAddress1, 80);
Console.WriteLine("\nIPEndPoint information:" + hostIPEndPoint.ToString());
Console.WriteLine("\n\tMaximum allowed Port Address :" + IPEndPoint.MaxPort);
Console.WriteLine("\n\tMinimum allowed Port Address :" + IPEndPoint.MinPort);
Console.WriteLine("\n\tAddress Family :" + hostIPEndPoint.AddressFamily);
}
}
The code above generates the following result.