Skip to main content
StreamSocketControl class

Provides socket control data on a StreamSocket object.

Syntax


var streamSocketControl = control;

public sealed class StreamSocketControl

Public NotInheritable Class StreamSocketControl

public ref class StreamSocketControl sealed 

Members

The StreamSocketControl class has these types of members:

Properties

The StreamSocketControl class has these properties.

PropertyAccess typeDescription

ClientCertificate

Read/write

Gets or sets the client SSL/TLS certificate that will be sent to the server if the server requests a client certificate.

IgnorableServerCertificateErrors

Read-only

Get a vector of SSL server errors to ignore when making an SSL connection with a StreamSocket.

KeepAlive

Read/write

A value that indicates whether keep-alive packets are sent to the remote destination on a StreamSocket object.

NoDelay

Read/write

A value that indicates whether the Nagle algorithm is used on a StreamSocket object.

OutboundBufferSizeInBytes

Read/write

The size, in bytes, of the send buffer to be used for sending data on a StreamSocket object.

OutboundUnicastHopLimit

Read/write

The hop limit on an outbound packet sent to a unicast IP address by the StreamSocket object.

QualityOfService

Read/write

The quality of service on a StreamSocket object.

SerializeConnectionAttempts

Read/write

A value that indicates whether, when multiple connection attempts are being made, the attempts are made in parallel or serially.

 

Remarks

The StreamSocketControl class provides access to advanced socket control data on a StreamSocket object.

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

Any changes to the property values on the StreamSocketControl must be set before the StreamSocket is connected. As a result if you need to make changes to the ClientCertificate, IgnorableServerCertificateErrors, KeepAlive, NoDelay, OutboundBufferSizeInBytes , OutboundUnicastHopLimit, or QualityOfService properties, then these changes must occur before a successful call to one of the ConnectAsync methods on the StreamSocket.

Use the ClientCertificate to set a client certificate to be used to make secure connections over the associated StreamSocket object.

The following example creates a StreamSocket, and then demonstrates how to set the NoDelay property to false. Other properties may be set in a similar manner. After this is done, the app can connect the StreamSocket.


var clientSocket = new Windows.Networking.Sockets.StreamSocket();

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

// Set noDelay to false so that the Nagle algorithm is not disabled
clientSocket.control.noDelay = false;
   
// Now you can call the ConnectAsync method to connect the StreamWebSocket.

using Windows.Networking.Sockets;

StreamSocket clientSocket = new StreamSocket();

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

// Set NoDelay to false so that the Nagle algorithm is not disabled
clientSocket.Control.NoDelay = false;

// Now you can call the ConnectAsync method to connect the StreamSocket.

using namespace Windows::Networking::Sockets;

StreamSocket^ clientSocket = ref new StreamSocket();

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

// Set NoDelay to false so that the Nagle algorithm is not disabled
clientSocket->Control->NoDelay = false;

// Now you can call the ConnectAsync method to connect the StreamSocket.

For more information on using StreamSocketControl, see How to use advanced socket controls (HTML) and How to use advanced socket controls (XAML).

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Networking.Sockets
Windows::Networking::Sockets [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Capabilities

bluetooth.rfcomm

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 [Windows Store apps, desktop apps]

Minimum supported phone

Windows Phone 8

Namespace

Windows.Networking.Sockets
Windows::Networking::Sockets [C++]

Metadata

Windows.winmd

Capabilities

ID_CAP_NETWORKING [Windows Phone]
bluetooth.rfcomm

Attributes

[ DualApiPartition()]
[ MarshalingBehavior(Agile)]
[ Version(0x06020000)]

See also

Other resources
Connecting with sockets (HTML)
Connecting with sockets (XAML)
How to use advanced socket controls (HTML)
How to use advanced socket controls (XAML)
Reference
Object
StreamSocket
StreamSocket.Control
StreamSocketInformation
Samples
ControlChannelTrigger StreamSocket sample
StreamSocket sample