ReceiveAsync Method

ClientWebSocket.ReceiveAsync Method (ArraySegment<Byte>, CancellationToken)

.NET Framework 4.6 and 4.5

Receive data on ClientWebSocket as an asynchronous operation.

Namespace:   System.Net.WebSockets
Assembly:  System (in System.dll)

public override Task<WebSocketReceiveResult> ReceiveAsync(
	ArraySegment<byte> buffer,
	CancellationToken cancellationToken


Type: System.ArraySegment<Byte>

The buffer to receive the response.

Type: System.Threading.CancellationToken

A cancellation token used to propagate notification that this operation should be canceled.

Return Value

Type: System.Threading.Tasks.Task<WebSocketReceiveResult>

Returns Task<TResult>.

The task object representing the asynchronous operation.

This operation will not block. The returned Task<TResult> object will complete after the receive request on the ClientWebSocket instance has completed.

.NET Framework
Available since 4.5
Return to top
© 2015 Microsoft