ClientWebSocket::SendAsync Method (ArraySegment<Byte>, WebSocketMessageType, Boolean, CancellationToken)

.NET Framework (current version)
 

Send data on ClientWebSocket as an asynchronous operation.

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

public:
virtual Task^ SendAsync(
	ArraySegment<unsigned char> buffer,
	WebSocketMessageType messageType,
	bool endOfMessage,
	CancellationToken cancellationToken
) override

Parameters

buffer
Type: System::ArraySegment<Byte>

The buffer containing the message to be sent.

messageType
Type: System.Net.WebSockets::WebSocketMessageType

Specifies whether the buffer is clear text or in a binary format.

endOfMessage
Type: System::Boolean

Specifies whether this is the final asynchronous send. Set to true if this is the final send; false otherwise.

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^

The task object representing the asynchronous operation.

This operation will not block. The returned Task object will complete after the send request on the ClientWebSocket instance has completed.

Exactly one send and one receive is supported on each ClientWebSocket object in parallel.

.NET Framework
Available since 4.5
Return to top
Show: