C# IPEndPoint MinPort

Description

IPEndPoint MinPort Specifies the minimum value that can be assigned to the Port property. This field is read-only.

Syntax

IPEndPoint.MinPort has the following syntax.


public const int MinPort

Example

The following example uses the MinPort property to print the minimum value that can be assigned to the Port property.


/* w w  w  . j a  v  a 2s .  c  om*/

using System;
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.





















Home »
  C# Tutorial »
    System.Net »




Cookie
Dns
IPAddress
IPEndPoint
IPHostEntry
WebClient