WebSocket::ReceiveAsync Method (ArraySegment<Byte>, CancellationToken)
.NET Framework (current version)
Receives data from the WebSocket connection asynchronously.
Assembly: System (in System.dll)
public: virtual Task<WebSocketReceiveResult^>^ ReceiveAsync( ArraySegment<unsigned char> buffer, CancellationToken cancellationToken ) abstract
Parameters
- buffer
-
Type:
System::ArraySegment<Byte>
References the application buffer that is the storage location for the received data.
- cancellationToken
-
Type:
System.Threading::CancellationToken
Propagates the notification that operations should be canceled.
Return Value
Type: System.Threading.Tasks::Task<WebSocketReceiveResult^>^Returns Task<TResult>.
The task object representing the asynchronous operation. The Result property on the task object returns a Byte array containing the received data.
This operation will not block. The returned Task<TResult> object will complete after the data has been received on the WebSocket.
Exactly one send and one receive is supported on each WebSocket object in parallel.
.NET Framework
Available since 4.5
Available since 4.5
Show: