ClientWebSocket.SendAsync Método
Definição
Sobrecargas
| SendAsync(ArraySegment<Byte>, WebSocketMessageType, Boolean, CancellationToken) |
Envia dados no ClientWebSocket como uma operação assíncrona.Sends data on ClientWebSocket as an asynchronous operation. |
| SendAsync(ReadOnlyMemory<Byte>, WebSocketMessageType, Boolean, CancellationToken) |
Envia dados no ClientWebSocket de um intervalo de memória de bytes somente leitura como uma operação assíncrona.Sends data on ClientWebSocket from a read-only byte memory range as an asynchronous operation. |
SendAsync(ArraySegment<Byte>, WebSocketMessageType, Boolean, CancellationToken)
Envia dados no ClientWebSocket como uma operação assíncrona.Sends data on ClientWebSocket as an asynchronous operation.
public:
override System::Threading::Tasks::Task ^ SendAsync(ArraySegment<System::Byte> buffer, System::Net::WebSockets::WebSocketMessageType messageType, bool endOfMessage, System::Threading::CancellationToken cancellationToken);
public override System.Threading.Tasks.Task SendAsync (ArraySegment<byte> buffer, System.Net.WebSockets.WebSocketMessageType messageType, bool endOfMessage, System.Threading.CancellationToken cancellationToken);
override this.SendAsync : ArraySegment<byte> * System.Net.WebSockets.WebSocketMessageType * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overrides Function SendAsync (buffer As ArraySegment(Of Byte), messageType As WebSocketMessageType, endOfMessage As Boolean, cancellationToken As CancellationToken) As Task
Parâmetros
- buffer
- ArraySegment<Byte>
O buffer que contém a mensagem a ser enviada.The buffer containing the message to be sent.
- messageType
- WebSocketMessageType
Um dos valores da enumeração que especifica se o buffer é de texto não criptografado ou em um formato binário.One of the enumeration values that specifies whether the buffer is clear text or in a binary format.
- endOfMessage
- Boolean
true para indicar que este é o envio assíncrono final; caso contrário, false.true to indicate this is the final asynchronous send; otherwise, false.
- cancellationToken
- CancellationToken
Um token de cancelamento usado para propagar a notificação de que essa operação deve ser cancelada.A cancellation token used to propagate notification that this operation should be canceled.
Retornos
O objeto de tarefa que representa a operação assíncrona.The task object representing the asynchronous operation.
Exceções
O ClientWebSocket não está conectado.The ClientWebSocket is not connected.
O ClientWebSocket foi fechado.The ClientWebSocket has been closed.
Comentários
Esta operação não será bloqueada.This operation will not block. O Task objeto retornado será concluído depois que a solicitação de envio na ClientWebSocket instância for concluída.The returned Task object will complete after the send request on the ClientWebSocket instance has completed.
Exatamente um envio e um Receive têm suporte em cada ClientWebSocket objeto em paralelo.Exactly one send and one receive is supported on each ClientWebSocket object in parallel.
Aplica-se a
SendAsync(ReadOnlyMemory<Byte>, WebSocketMessageType, Boolean, CancellationToken)
Envia dados no ClientWebSocket de um intervalo de memória de bytes somente leitura como uma operação assíncrona.Sends data on ClientWebSocket from a read-only byte memory range as an asynchronous operation.
public:
override System::Threading::Tasks::ValueTask SendAsync(ReadOnlyMemory<System::Byte> buffer, System::Net::WebSockets::WebSocketMessageType messageType, bool endOfMessage, System::Threading::CancellationToken cancellationToken);
public override System.Threading.Tasks.ValueTask SendAsync (ReadOnlyMemory<byte> buffer, System.Net.WebSockets.WebSocketMessageType messageType, bool endOfMessage, System.Threading.CancellationToken cancellationToken);
override this.SendAsync : ReadOnlyMemory<byte> * System.Net.WebSockets.WebSocketMessageType * bool * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
Public Overrides Function SendAsync (buffer As ReadOnlyMemory(Of Byte), messageType As WebSocketMessageType, endOfMessage As Boolean, cancellationToken As CancellationToken) As ValueTask
Parâmetros
- buffer
- ReadOnlyMemory<Byte>
A região de memória que contém a mensagem a ser enviada.The region of memory containing the message to be sent.
- messageType
- WebSocketMessageType
Um dos valores da enumeração que especifica se o buffer é de texto não criptografado ou em um formato binário.One of the enumeration values that specifies whether the buffer is clear text or in a binary format.
- endOfMessage
- Boolean
true para indicar que este é o envio assíncrono final; caso contrário, false.true to indicate this is the final asynchronous send; otherwise, false.
- cancellationToken
- CancellationToken
Um token de cancelamento usado para propagar a notificação de que essa operação deve ser cancelada.A cancellation token used to propagate notification that this operation should be canceled.
Retornos
O objeto de tarefa que representa a operação assíncrona.The task object representing the asynchronous operation.
Exceções
O ClientWebSocket não está conectado.The ClientWebSocket is not connected.
O ClientWebSocket foi fechado.The ClientWebSocket has been closed.
Comentários
Esta operação não será bloqueada.This operation will not block. O Task objeto retornado será concluído depois que a solicitação de envio na ClientWebSocket instância for concluída.The returned Task object will complete after the send request on the ClientWebSocket instance has completed.
Exatamente um envio e um Receive têm suporte em cada ClientWebSocket objeto em paralelo.Exactly one send and one receive is supported on each ClientWebSocket object in parallel.