WebSocket.ReceiveAsync Method

Definition

Overloads

ReceiveAsync(ArraySegment<Byte>, CancellationToken)

Riceve i dati dalla connessione WebSocket in modo asincrono.Receives data from the WebSocket connection asynchronously.

ReceiveAsync(Memory<Byte>, CancellationToken)

Riceve i dati dalla connessione WebSocket in modo asincrono.Receives data from the WebSocket connection asynchronously.

ReceiveAsync(ArraySegment<Byte>, CancellationToken)

Riceve i dati dalla connessione WebSocket in modo asincrono.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>
Public MustOverride Function ReceiveAsync (buffer As ArraySegment(Of Byte), cancellationToken As CancellationToken) As Task(Of WebSocketReceiveResult)

Parameters

buffer
ArraySegment<Byte>

Fa riferimento al buffer dell'applicazione che è il percorso di archiviazione per i dati ricevuti.References the application buffer that is the storage location for the received data.

cancellationToken
CancellationToken

Propaga la notifica di richiesta di annullamento delle operazioni.Propagates the notification that operations should be canceled.

Returns

Task<WebSocketReceiveResult>

Oggetto attività che rappresenta l'operazione asincrona.The task object representing the asynchronous operation. La proprietà Result sull'oggetto attività restituisce un oggetto WebSocketReceiveResult che rappresenta i dati ricevuti.The Result property on the task object returns a WebSocketReceiveResult object that represents the received data.

Remarks

Questa operazione non verrà bloccata.This operation will not block. L'oggetto Task<TResult> restituito viene completato dopo la ricezione dei dati nel WebSocket.The returned Task<TResult> object will complete after the data has been received on the WebSocket.

Una sola trasmissione e una ricezione sono supportate in ogni oggetto WebSocket in parallelo.Exactly one send and one receive is supported on each WebSocket object in parallel.

ReceiveAsync(Memory<Byte>, CancellationToken)

Riceve i dati dalla connessione WebSocket in modo asincrono.Receives data from the WebSocket connection asynchronously.

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>
Public Overridable Function ReceiveAsync (buffer As Memory(Of Byte), cancellationToken As CancellationToken) As ValueTask(Of ValueWebSocketReceiveResult)

Parameters

buffer
Memory<Byte>

Buffer dell'applicazione che è il percorso di archiviazione per i dati ricevuti.The application buffer that is the storage location for the received data.

cancellationToken
CancellationToken

Token di annullamento da usare per annullare l'operazione di ricezione.The cancellation token to use to cancel the receive operation.

Returns

ValueTask<ValueWebSocketReceiveResult>

Oggetto attività che rappresenta l'operazione asincrona.The task object representing the asynchronous operation. La proprietà Result sull'oggetto attività restituisce un oggetto ValueWebSocketReceiveResult che rappresenta i dati ricevuti.The Result property on the task object returns a ValueWebSocketReceiveResult object that represents the received data.

Applies to