Export (0) Print
Expand All

WebSocket.SendAsync Method

.NET Framework 4.5

Sends data over the WebSocket connection asynchronously.

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

public abstract Task SendAsync(
	ArraySegment<byte> buffer,
	WebSocketMessageType messageType,
	bool endOfMessage,
	CancellationToken cancellationToken


Type: System.ArraySegment<Byte>

The buffer to be sent over the connection.

Type: System.Net.WebSockets.WebSocketMessageType

Indicates whether the application is sending a binary or text message.

Type: System.Boolean

Indicates whether the data in “buffer” is the last part of a message.

Type: System.Threading.CancellationToken

The token that propagates the notification that operations should be canceled.

Return Value

Type: System.Threading.Tasks.Task
Returns Task.
The task object representing the asynchronous operation.

This operation will not block. The returned Task object will complete after the data has been sent on the WebSocket.

.NET Framework

Supported in: 4.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

© 2014 Microsoft