StreamSocketControl StreamSocketControl StreamSocketControl StreamSocketControl StreamSocketControl Class

Definition

Provides socket control data on a StreamSocket object.

public : sealed class StreamSocketControl : IStreamSocketControl, IStreamSocketControl2, IStreamSocketControl3, IStreamSocketControl4
struct winrt::Windows::Networking::Sockets::StreamSocketControl : IStreamSocketControl, IStreamSocketControl2, IStreamSocketControl3, IStreamSocketControl4
public sealed class StreamSocketControl : IStreamSocketControl, IStreamSocketControl2, IStreamSocketControl3, IStreamSocketControl4
Public NotInheritable Class StreamSocketControl Implements IStreamSocketControl, IStreamSocketControl2, IStreamSocketControl3, IStreamSocketControl4
// 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
bluetooth.rfcomm ID_CAP_NETWORKING [Windows Phone]

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.

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.
#include <winrt/Windows.Networking.Sockets.h>
using namespace winrt;
...
Windows::Networking::Sockets::StreamSocket clientSocket;

// 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 function 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.
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.

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

Properties

ClientCertificate ClientCertificate ClientCertificate ClientCertificate ClientCertificate

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

IgnorableServerCertificateErrors IgnorableServerCertificateErrors IgnorableServerCertificateErrors IgnorableServerCertificateErrors IgnorableServerCertificateErrors

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

KeepAlive KeepAlive KeepAlive KeepAlive KeepAlive

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

MinProtectionLevel MinProtectionLevel MinProtectionLevel MinProtectionLevel MinProtectionLevel

Constrains the TLS protocol version that will be negotiated when the developer uses the ConnectAsync() or UpgradeToSslAsync() methods that require TLS.

NoDelay NoDelay NoDelay NoDelay NoDelay

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

OutboundBufferSizeInBytes OutboundBufferSizeInBytes OutboundBufferSizeInBytes OutboundBufferSizeInBytes OutboundBufferSizeInBytes

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

OutboundUnicastHopLimit OutboundUnicastHopLimit OutboundUnicastHopLimit OutboundUnicastHopLimit OutboundUnicastHopLimit

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

QualityOfService QualityOfService QualityOfService QualityOfService QualityOfService

The quality of service on a StreamSocket object.

SerializeConnectionAttempts SerializeConnectionAttempts SerializeConnectionAttempts SerializeConnectionAttempts SerializeConnectionAttempts

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

See Also