Language

StreamSocketControl クラス

定義

StreamSocket オブジェクトにソケット コントロール データを提供します。

public ref class StreamSocketControl sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class StreamSocketControl final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class StreamSocketControl
Public NotInheritable Class StreamSocketControl
継承
Object Platform::Object IInspectable StreamSocketControl
属性

Windows の要件

要件 説明
デバイス ファミリ
Windows 10 (10.0.10240.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v1.0 で導入)
アプリの機能
bluetooth.rfcomm

注釈

StreamSocketControl クラスは、 StreamSocket オブジェクトの高度なソケット制御データへのアクセスを提供します。

StreamSocketControl オブジェクトは、親 StreamSocket オブジェクトを使用して自動的に作成されます。 StreamSocket.Control プロパティは、関連付けられている StreamSocketControl オブジェクトへのアクセスを提供します。

StreamSocketControl のプロパティ値に対する変更は、 StreamSocket が接続される前に設定する必要があります。 その結果、ClientCertificate、IgnorableServerCertificateErrors、KeepAlive、NoDelay、OutboundBufferSizeInBytes、OutboundUnicastHopLimit、または QualityOfService プロパティを変更する必要がある場合は、StreamSocket で ConnectAsync メソッドの 1 つを正常に呼び出す前に、これらの変更を行う必要があります。

ClientCertificate を使用して、関連付けられている StreamSocket オブジェクトを介してセキュリティで保護された接続を行うために使用するクライアント証明書を設定します。

次の例では、 StreamSocket を作成し、 NoDelay プロパティを false に設定する方法を示します。 他のプロパティも同様の方法で設定できます。 これが完了すると、アプリは 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.

StreamSocketControl の使用方法の詳細については、「 高度なソケット コントロールを使用する方法」を参照してください。

バージョン履歴

Windows のバージョン SDK のバージョン 付加価値
1709 16299 MinProtectionLevel

プロパティ

Name 説明
ClientCertificate

サーバーがクライアント証明書を要求した場合にサーバーに送信されるクライアント SSL/TLS 証明書を取得または設定します。

IgnorableServerCertificateErrors

StreamSocket との SSL 接続を確立するときに無視する SSL サーバー エラーのベクトルを取得します。

KeepAlive

キープアライブ パケットが StreamSocket オブジェクトのリモート宛先に送信されるかどうかを示す値。

MinProtectionLevel

開発者が TLS を必要とする ConnectAsync() または UpgradeToSslAsync() メソッドを使用するときにネゴシエートされる TLS プロトコルのバージョンを制限します。

NoDelay

Nagle アルゴリズムが StreamSocket オブジェクトで使用されるかどうかを示す値。

OutboundBufferSizeInBytes

StreamSocket オブジェクトでデータを送信するために使用される送信バッファーのサイズ (バイト単位)。

OutboundUnicastHopLimit

StreamSocket オブジェクトによってユニキャスト IP アドレスに送信される送信パケットのホップ制限。

QualityOfService

StreamSocket オブジェクトのサービスの品質。

SerializeConnectionAttempts

複数の接続試行が行われているときに、試行が並列または順次行われるかどうかを示す値。

適用対象

関連項目