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

.NET Framework (current version)
 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Receives a single message fragment from a remote client.

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

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

Parameters

buffer
Type: System.ArraySegment<Byte>

The array that contains the message data.

cancellationToken
Type: System.Threading.CancellationToken

The object that cancels a pending operation.

Return Value

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

A reference to the task of receiving a message.

Exception Condition
ObjectDisposedException

The AspNetWebSocket object was previously disposed.

System.InvalidOperationException

The AspNetWebSocket object is in an aborted state.

-or-

Receiving operations are unavailable.

.NET Framework
Available since 4.5
Return to top
Show: