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 개체에 대한 액세스를 제공합니다.

StreamSocketListener가 바인딩되기 전에 StreamSocketListenerControl 속성 값에 대한 변경 내용을 설정해야 합니다. 따라서 StreamSocketListener에서 BindServiceNameAsync 또는 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 개체에 설정할 서비스 품질입니다.

적용 대상

추가 정보