WebSocket.SendAsync 方法

定義

多載

SendAsync(ArraySegment<Byte>, WebSocketMessageType, Boolean, CancellationToken)

以非同步的方式透過 WebSocket 連線傳送資料。Sends data over the WebSocket connection asynchronously.

SendAsync(ReadOnlyMemory<Byte>, WebSocketMessageType, Boolean, CancellationToken)

SendAsync(ArraySegment<Byte>, WebSocketMessageType, Boolean, CancellationToken)

以非同步的方式透過 WebSocket 連線傳送資料。Sends data over the WebSocket connection asynchronously.

public:
 abstract System::Threading::Tasks::Task ^ SendAsync(ArraySegment<System::Byte> buffer, System::Net::WebSockets::WebSocketMessageType messageType, bool endOfMessage, System::Threading::CancellationToken cancellationToken);
public abstract System.Threading.Tasks.Task SendAsync (ArraySegment<byte> buffer, System.Net.WebSockets.WebSocketMessageType messageType, bool endOfMessage, System.Threading.CancellationToken cancellationToken);
abstract member SendAsync : ArraySegment<byte> * System.Net.WebSockets.WebSocketMessageType * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task

參數

buffer
ArraySegment<Byte>

要透過連線傳送的緩衝區。The buffer to be sent over the connection.

messageType
WebSocketMessageType

指出應用程式是否正在傳送二進位或文字訊息。Indicates whether the application is sending a binary or text message.

endOfMessage
Boolean

指出「緩衝區」中的資料是否為訊息的最後一部分。Indicates whether the data in "buffer" is the last part of a message.

cancellationToken
CancellationToken

傳播應該取消作業之通知的語彙基元。The token that propagates the notification that operations should be canceled.

傳回

工作物件,表示非同步作業。The task object representing the asynchronous operation.

備註

這項作業不會封鎖。This operation will not block. 傳回Task的物件將會在資料傳送WebSocket至之後完成。The returned Task object will complete after the data has been sent on the WebSocket.

每個WebSocket物件只會以平行方式支援一個傳送和一個接收。Exactly one send and one receive is supported on each WebSocket object in parallel.

SendAsync(ReadOnlyMemory<Byte>, WebSocketMessageType, Boolean, CancellationToken)

public:
 virtual System::Threading::Tasks::ValueTask SendAsync(ReadOnlyMemory<System::Byte> buffer, System::Net::WebSockets::WebSocketMessageType messageType, bool endOfMessage, System::Threading::CancellationToken cancellationToken);
public virtual System.Threading.Tasks.ValueTask SendAsync (ReadOnlyMemory<byte> buffer, System.Net.WebSockets.WebSocketMessageType messageType, bool endOfMessage, System.Threading.CancellationToken cancellationToken);
abstract member SendAsync : ReadOnlyMemory<byte> * System.Net.WebSockets.WebSocketMessageType * bool * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
override this.SendAsync : ReadOnlyMemory<byte> * System.Net.WebSockets.WebSocketMessageType * bool * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask

參數

messageType
WebSocketMessageType
endOfMessage
Boolean
cancellationToken
CancellationToken

傳回

適用於