Share via


AspNetWebSocket.ReceiveAsync Metodo

Definizione

Riceve un singolo frammento di messaggio da un client remoto.

public:
 override System::Threading::Tasks::Task<System::Net::WebSockets::WebSocketReceiveResult ^> ^ ReceiveAsync(ArraySegment<System::Byte> buffer, System::Threading::CancellationToken cancellationToken);
public override System.Threading.Tasks.Task<System.Net.WebSockets.WebSocketReceiveResult> ReceiveAsync (ArraySegment<byte> buffer, System.Threading.CancellationToken cancellationToken);
override this.ReceiveAsync : ArraySegment<byte> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.WebSockets.WebSocketReceiveResult>
Public Overrides Function ReceiveAsync (buffer As ArraySegment(Of Byte), cancellationToken As CancellationToken) As Task(Of WebSocketReceiveResult)

Parametri

buffer
ArraySegment<Byte>

Matrice che contiene i dati del messaggio.

cancellationToken
CancellationToken

Oggetto che annulla un'operazione in sospeso.

Restituisce

Riferimento all'attività di ricezione di un messaggio.

Eccezioni

L'oggetto AspNetWebSocket è già stato eliminato.

L'oggetto AspNetWebSocket si trova in uno stato interrotto.

-oppure-

Operazioni di ricezione non disponibili.

Il token di annullamento è stato annullato. Questa eccezione viene archiviata nell'attività restituita.

Si applica a