StreamSocketListenerControl StreamSocketListenerControl StreamSocketListenerControl StreamSocketListenerControl StreamSocketListenerControl Class

Definition

Provides socket control data on a StreamSocketListener object.

public : sealed class StreamSocketListenerControl : IStreamSocketListenerControl, IStreamSocketListenerControl2
struct winrt::Windows::Networking::Sockets::StreamSocketListenerControl : IStreamSocketListenerControl, IStreamSocketListenerControl2
public sealed class StreamSocketListenerControl : IStreamSocketListenerControl, IStreamSocketListenerControl2
Public NotInheritable Class StreamSocketListenerControl Implements IStreamSocketListenerControl, IStreamSocketListenerControl2
// 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 StreamSocketListenerControl class provides access to advanced socket control data on a StreamSocketListener object.

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

Any changes to the StreamSocketListenerControl property values must be set before the StreamSocketListener is bound. So changes to the QualityOfService property must be set before the BindServiceNameAsync or BindEndpointAsync method is called on the StreamSocketListener.

The following example creates a StreamSocketListener, and then demonstrates how to set the QualityOfService property to LowLatency. After this is done, the app can bind and listen on the StreamSocketListener.

var listenerSocket = new Windows.Networking.Sockets.StreamSocketListener();

// Get the current setting for this option
// This isn't required, but it shows how to get the current setting
var currentSetting = listenerSocket.Control.QualityOfService; 

// Set QualityOfService to lowLatency
listenerSocket.Control.QualityOfService = SocketQualityOfService.lowLatency;

// Now you can call the BindServiceNameAsync or BindEndpointAsync method to listen for connections.
using Windows.Networking.Sockets;

StreamSocketListener listenerSocket = new StreamSocketListener();

// Get the current setting for this option
// This isn't required, but it shows how to get the current setting
bool currentSetting = listenerSocket.Control.QualityOfService;

// Set QualityOfService to lowLatency
listenerSocket.Control.QualityOfService = SocketQualityOfService.lowLatency;

// Now you can call the BindServiceNameAsync or BindEndpointAsync method to listen for connections.

using namespace Windows::Networking::Sockets;

StreamSocketListener^ listenerSocket = ref new StreamSocketListener();

// Get the current setting for this option
// This isn't required, but it shows how to get the current setting 
bool currentSetting = listenerSocket->Control->QualityOfService;

// Set QualityOfService to lowLatency
listenerSocket->Control->QualityOfService = SocketQualityOfService.lowLatency;

// Now you can call the BindServiceNameAsync or BindEndpointAsync method to listen for connections.

For more information on using StreamSocketListenerControl, see How to use advanced socket controls and How to use advanced socket controls .

Properties

KeepAlive KeepAlive KeepAlive KeepAlive KeepAlive

A value that indicates whether keep-alive packets should be sent on a StreamSocket object created when a connection is received by the StreamSocketListener object.

NoDelay NoDelay NoDelay NoDelay NoDelay

A value that indicates whether the Nagle algorithm is used on a StreamSocket object created when a connection is received by the StreamSocketListener object.

OutboundBufferSizeInBytes OutboundBufferSizeInBytes OutboundBufferSizeInBytes OutboundBufferSizeInBytes OutboundBufferSizeInBytes

The size, in bytes, of the send buffer to be used for sending data on a StreamSocket object created when a connection is received by the StreamSocketListener object.

OutboundUnicastHopLimit OutboundUnicastHopLimit OutboundUnicastHopLimit OutboundUnicastHopLimit OutboundUnicastHopLimit

The hop limit on an outbound packet sent to a unicast IP address by the StreamSocket object created when a connection is received by the StreamSocketListener object.

QualityOfService QualityOfService QualityOfService QualityOfService QualityOfService

The quality of service to be set on a StreamSocket object created when a connection is received by the StreamSocketListener object.

See Also