StreamSocketListenerControl クラス

定義

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

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

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10240.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v1.0 で導入)
アプリの機能
ID_CAP_NETWORKING [Windows Phone]

注釈

StreamSocketListenerControl クラスを使用すると、 StreamSocketListener オブジェクト上の高度なソケット制御データにアクセスできます。

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

StreamSocketListenerControl プロパティ値に対する変更は、 StreamSocketListener を バインドする前に設定する必要があります。 そのため、StreamSocketListenerBindServiceNameAsync メソッドまたは BindEndpointAsync メソッドを呼び出す前に、QualityOfService プロパティの変更を設定する必要があります。

次の例では、 StreamSocketListener を作成し、 QualityOfService プロパティを LowLatency に設定する方法を示します。 これが完了すると、アプリは StreamSocketListener をバインドしてリッスンできます。

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

// Get the current setting for this option.
// This isn't required, but it shows how to get the current setting.
auto currentSetting{ listenerSocket.Control().QualityOfService() };

// Set QualityOfService to LowLatency.
listenerSocket.Control().QualityOfService(Windows::Networking::Sockets::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.
auto 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.

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

プロパティ

KeepAlive

StreamSocketListener オブジェクトが接続を受信したときに作成された StreamSocket オブジェクトでキープアライブ パケットを送信するかどうかを示す 値です。

NoDelay

StreamSocketListener オブジェクトが接続を受信したときに作成された StreamSocket オブジェクトで Nagle アルゴリズムを使用するかどうかを示す 値です。

OutboundBufferSizeInBytes

StreamSocketListener オブジェクトが接続を受信したときに作成された StreamSocket オブジェクトでデータを送信するために使用される送信バッファーのサイズ (バイト単位)。

OutboundUnicastHopLimit

StreamSocketListener オブジェクトが接続を受信したときに作成された StreamSocket オブジェクトによってユニキャスト IP アドレスに送信される送信パケットのホップ制限。

QualityOfService

StreamSocketListener オブジェクトが接続を受信したときに作成される StreamSocket オブジェクトに設定されるサービスの品質。

適用対象

こちらもご覧ください