StreamSocketListenerControl Clase

Definición

Proporciona datos de control de socket en un objeto 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
Herencia
Object Platform::Object IInspectable StreamSocketListenerControl
Atributos

Requisitos de Windows

Familia de dispositivos
Windows 10 (se introdujo en la versión 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (se introdujo en la versión v1.0)
Características de aplicaciones
ID_CAP_NETWORKING [Windows Phone]

Comentarios

La clase StreamSocketListenerControl proporciona acceso a datos de control de socket avanzados en un objeto StreamSocketListener .

Un objeto StreamSocketListenerControl se crea automáticamente con el objeto Primario StreamSocketListener . La propiedad StreamSocketListener.Control proporciona acceso al objeto StreamSocketListenerControl asociado.

Los cambios realizados en los valores de la propiedad StreamSocketListenerControl deben establecerse antes de que streamSocketListener esté enlazado. Por lo tanto, los cambios realizados en la propiedad QualityOfService deben establecerse antes de llamar al método BindServiceNameAsync o BindEndpointAsync en streamSocketListener.

En el ejemplo siguiente se crea un Objeto StreamSocketListener y, a continuación, se muestra cómo establecer la propiedad QualityOfService en LowLatency. Una vez hecho esto, la aplicación puede enlazar y escuchar en 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.

Para obtener más información sobre el uso de StreamSocketListenerControl, consulte Uso de controles de socket avanzados.

Propiedades

KeepAlive

Valor que indica si los paquetes keep-alive deben enviarse en un objeto StreamSocket creado cuando el objeto StreamSocketListener recibe una conexión.

NoDelay

Valor que indica si el algoritmo nagle se usa en un objeto StreamSocket creado cuando el objeto StreamSocketListener recibe una conexión.

OutboundBufferSizeInBytes

Tamaño, en bytes, del búfer de envío que se usará para enviar datos en un objeto StreamSocket creado cuando el objeto StreamSocketListener recibe una conexión.

OutboundUnicastHopLimit

Límite de salto en un paquete de salida enviado a una dirección IP de unidifusión por el objeto StreamSocket creado cuando el objeto StreamSocketListener recibe una conexión.

QualityOfService

La calidad del servicio que se va a establecer en un objeto StreamSocket creado cuando el objeto StreamSocketListener recibe una conexión.

Se aplica a

Consulte también