ClientWebSocket.ReceiveAsync Method

.NET Framework 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
)

Parameters

buffer
Type: System.ArraySegment<Byte>

The buffer to receive the response.

cancellationToken
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

Supported in: 4.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft