IPEndPoint.MaxPort Field

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Specifies the maximum value that can be assigned to the Port property. The MaxPort value is set to 0x0000FFFF. This field is read-only.

Namespace:   System.Net
Assembly:  System (in System.dll)

Public Const MaxPort As Integer

Field Value

Type: System.Int32

The following example uses the MaxPort property to print the maximum value that can be assigned to the Port property.

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()))

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.1
Return to top
Show: