Export (0) Print
Expand All

IPEndPoint.MinPort Field

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

[Visual Basic]
Public Const MinPort As Integer
[C#]
public const int MinPort;
[C++]
public: const int MinPort;
[JScript]
public var MinPort : int;

Example

[Visual Basic, C#, C++] The following example uses the MinPort property to print the minimum value that can be assigned to the Port property.

[Visual Basic] 
Dim hostIPAddress1 As IPAddress = Dns.Resolve(hostString1).AddressList(0)
Dim hostIPEndPoint As New IPEndPoint(hostIPAddress1, 80)
Console.WriteLine((ControlChars.Cr + "IPEndPoint information:" + hostIPEndPoint.ToString()))
Console.WriteLine((ControlChars.Cr + ControlChars.Tab + "Maximum allowed Port Address :" + IPEndPoint.MaxPort.ToString()))
Console.WriteLine((ControlChars.Cr + ControlChars.Tab + "Minimum allowed Port Address :" + IPEndPoint.MinPort.ToString()))
Console.WriteLine((ControlChars.Cr + ControlChars.Tab + "Address Family :" + hostIPEndPoint.AddressFamily.ToString()))

[C#] 

        

            IPAddress hostIPAddress1 = (Dns.Resolve(hostString1)).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);

[C++] 
IPAddress* hostIPAddress1 = (Dns::Resolve(hostString1))->AddressList[0];
Console::WriteLine(hostIPAddress1);
IPEndPoint* hostIPEndPoint = new IPEndPoint(hostIPAddress1,80);
Console::WriteLine(S"\nIPEndPoint information:{0}", hostIPEndPoint);
Console::WriteLine(S"\n\tMaximum allowed Port Address :{0}", __box(IPEndPoint::MaxPort));
Console::WriteLine(S"\n\tMinimum allowed Port Address :{0}", __box(IPEndPoint::MinPort));
Console::WriteLine(S"\n\tAddress Family :{0}", __box(hostIPEndPoint->AddressFamily));

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

IPEndPoint Class | IPEndPoint Members | System.Net Namespace

Show:
© 2014 Microsoft