WebSocket.ReceiveAsync Método

Definición

Sobrecargas

ReceiveAsync(ArraySegment<Byte>, CancellationToken)

Recibe datos de la conexión de WebSocket de forma asincrónica.Receives data from the WebSocket connection asynchronously.

ReceiveAsync(Memory<Byte>, CancellationToken)

ReceiveAsync(ArraySegment<Byte>, CancellationToken)

Recibe datos de la conexión de WebSocket de forma asincrónica.Receives data from the WebSocket connection asynchronously.

public:
 abstract System::Threading::Tasks::Task<System::Net::WebSockets::WebSocketReceiveResult ^> ^ ReceiveAsync(ArraySegment<System::Byte> buffer, System::Threading::CancellationToken cancellationToken);
public abstract System.Threading.Tasks.Task<System.Net.WebSockets.WebSocketReceiveResult> ReceiveAsync (ArraySegment<byte> buffer, System.Threading.CancellationToken cancellationToken);
abstract member ReceiveAsync : ArraySegment<byte> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.WebSockets.WebSocketReceiveResult>

Parámetros

buffer
ArraySegment<Byte>

Hace referencia al búfer de aplicación que es la ubicación de almacenamiento para los datos recibidos.References the application buffer that is the storage location for the received data.

cancellationToken
CancellationToken

Propaga la notificación de que las operaciones deben cancelarse.Propagates the notification that operations should be canceled.

Devoluciones

Objeto de tarea que representa la operación asincrónica.The task object representing the asynchronous operation. La propiedad Result en el objeto de tarea devuelve un objeto WebSocketReceiveResult que representa los datos recibidos.The Result property on the task object returns a WebSocketReceiveResult object that represents the received data.

Comentarios

Esta operación no se bloqueará.This operation will not block. El objeto Task<TResult> devuelto se completará después de que se hayan recibido WebSocketlos datos en.The returned Task<TResult> object will complete after the data has been received on the WebSocket.

Se admite exactamente un envío y una recepción en cada WebSocket objeto en paralelo.Exactly one send and one receive is supported on each WebSocket object in parallel.

ReceiveAsync(Memory<Byte>, CancellationToken)

public:
 virtual System::Threading::Tasks::ValueTask<System::Net::WebSockets::ValueWebSocketReceiveResult> ReceiveAsync(Memory<System::Byte> buffer, System::Threading::CancellationToken cancellationToken);
public virtual System.Threading.Tasks.ValueTask<System.Net.WebSockets.ValueWebSocketReceiveResult> ReceiveAsync (Memory<byte> buffer, System.Threading.CancellationToken cancellationToken);
abstract member ReceiveAsync : Memory<byte> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Net.WebSockets.ValueWebSocketReceiveResult>
override this.ReceiveAsync : Memory<byte> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Net.WebSockets.ValueWebSocketReceiveResult>

Parámetros

buffer
Memory<Byte>
cancellationToken
CancellationToken

Devoluciones

Se aplica a