Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 1.92 KB

streamsocketinformation_localport.md

File metadata and controls

31 lines (21 loc) · 1.92 KB
-api-id -api-type
P:Windows.Networking.Sockets.StreamSocketInformation.LocalPort
winrt property

Windows.Networking.Sockets.StreamSocketInformation.LocalPort

-description

Get the TCP port number associated with a StreamSocket.

-property-value

The local TCP port number of service name.

-remarks

The LocalPort property represents the local TCP port number the StreamSocket object is bound to after a connection is established.

An app can set the local service name or TCP port number to use by calling the ConnectAsync(EndpointPair) or ConnectAsync(EndpointPair, SocketProtectionLevel) method on the StreamSocket. The connect operation will bind the socket to the specific local IP address and local UDP port number. After the bind or connect operation completes, the LocalPort property contains the IP address and the LocalPort property contains the local TCP port number that the local hostname and service name resolved to.

If the local service name or TCP port number passed to the ConnectAsync(EndpointPair) or ConnectAsync(EndpointPair, SocketProtectionLevel) method is an empty string or the ConnectAsync(HostName, String) or ConnectAsync(HostName, String, SocketProtectionLevel) method is called, the system will determine the local TCP port number to bind to the StreamSocket object.

-examples

-see-also

How to use advanced socket controls, LocalAddress, StreamSocket

-capabilities

ID_CAP_NETWORKING [Windows Phone]