StreamSocketInformation.LocalPort Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Get the TCP port number associated with a StreamSocket.
public:
property Platform::String ^ LocalPort { Platform::String ^ get(); };
winrt::hstring LocalPort();
public string LocalPort { get; }
var string = streamSocketInformation.localPort;
Public ReadOnly Property LocalPort As String
Property Value
The local TCP port number of service name.
Windows requirements
App capabilities |
ID_CAP_NETWORKING [Windows Phone]
|
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.