Port Property
Collapse the table of content
Expand the table of content

IPEndPoint.Port Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets the port number of the endpoint.

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

'Declaration
Public Property Port As Integer

Property Value

Type: System.Int32
An integer value in the range MinPort to MaxPort indicating the port number of the endpoint.

ExceptionCondition
ArgumentOutOfRangeException

The value that was specified for a set operation is less than MinPort or greater than MaxPort.

The following example displays the Port property of the IPEndPoint specified.



Dim ipAddr2 As IPAddress = IPAddress.IPv6Loopback
Dim port2 As Integer = 80

Dim endpoint2 As IPEndPoint = new IPEndPoint(ipAddr2,port2)

outputBlock.Text &= "IPEndPoint.Address: "
outputBlock.Text &= endpoint2.Address.ToString()
outputBlock.Text &= vbCrLf

outputBlock.Text &= "IPEndPoint.AddressFamily: "
outputBlock.Text &= endpoint2.AddressFamily
outputBlock.Text &= vbCrLf

outputBlock.Text &= "IPEndPoint.Port: "
outputBlock.Text &= endpoint2.Port
outputBlock.Text &= vbCrLf

outputBlock.Text &= "IPEndPoint.ToString(): "
outputBlock.Text &= endpoint2.ToString()
outputBlock.Text &= vbCrLf


Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Show:
© 2017 Microsoft