StreamSocketListenerInformation StreamSocketListenerInformation StreamSocketListenerInformation StreamSocketListenerInformation Class

Definition

Provides socket information on a StreamSocketListener object.

public : sealed class StreamSocketListenerInformation : IStreamSocketListenerInformation
public sealed class StreamSocketListenerInformation : IStreamSocketListenerInformation
Public NotInheritable Class StreamSocketListenerInformation Implements IStreamSocketListenerInformation
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
ID_CAP_NETWORKING [Windows Phone]

Remarks

The StreamSocketListenerInformation class retrieves information on a StreamSocketListener and can be called any time after the StreamSocketListener has been created.

A StreamSocketListenerInformation object is automatically created with the parent StreamSocketListener object. The StreamSocketListener.Information property provides access to the associated StreamSocketListenerControl object.

Properties

LocalPort LocalPort LocalPort LocalPort

Get the local TCP port number associated with a StreamSocketListener object.

public : Platform::String LocalPort { get; }
public string LocalPort { get; }
Public ReadOnly Property LocalPort As string
var string = streamSocketListenerInformation.localPort;
Value
Platform::String string string string

The local TCP port number or service name.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
ID_CAP_NETWORKING [Windows Phone]

Remarks

The LocalPort property represents the local TCP port number bound to the StreamSocketListener object.

An app can set the local service name or TCP port number by calling the BindServiceNameAsync or BindEndpointAsync method on the StreamSocketListener. These methods will bind the StreamSocketListener object to the specific local IP address and local UDP port number. After the bind completes, the LocalPort property contains the local TCP port number that the local service name resolved to.

The BindEndpointAsync method will bind the socket to a specific IP address or hostname and a specific local TCP port number or service name .

The BindServiceNameAsync method will bind the socket to the specific TCP port number or service name. The system will determine the local IP address or hostname to associate with a StreamSocketListener object.

After the initial bind operation completes, LocalPort is read only and cannot be changed by calling the BindServiceNameAsync or BindEndpointAsync method again. The LocalPort property can be used at any time to get the local TCP port number associated with a StreamSocketListener object.

See Also

See Also