SocketTaskExtensions.SendToAsync(Socket, ArraySegment<Byte>, SocketFlags, EndPoint) Método

Definição

Envia dados de maneira assíncrona para um host remoto específico.Sends data asynchronously to a specific remote host.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<int> ^ SendToAsync(System::Net::Sockets::Socket ^ socket, ArraySegment<System::Byte> buffer, System::Net::Sockets::SocketFlags socketFlags, System::Net::EndPoint ^ remoteEP);
public static System.Threading.Tasks.Task<int> SendToAsync (this System.Net.Sockets.Socket socket, ArraySegment<byte> buffer, System.Net.Sockets.SocketFlags socketFlags, System.Net.EndPoint remoteEP);
static member SendToAsync : System.Net.Sockets.Socket * ArraySegment<byte> * System.Net.Sockets.SocketFlags * System.Net.EndPoint -> System.Threading.Tasks.Task<int>
<Extension()>
Public Function SendToAsync (socket As Socket, buffer As ArraySegment(Of Byte), socketFlags As SocketFlags, remoteEP As EndPoint) As Task(Of Integer)

Parâmetros

socket
Socket

O soquete no qual executar a operação.The socket to perform the operation on.

buffer
ArraySegment<Byte>

Uma matriz que contém os dados a serem enviados.An array that contains the data to send.

socketFlags
SocketFlags

Uma combinação bit a bit dos valores SocketFlags.A bitwise combination of the SocketFlags values.

remoteEP
EndPoint

Um EndPoint que representa o dispositivo remoto.An EndPoint that represents the remote device.

Retornos

Task<Int32>

Uma tarefa assíncrona concluída com o número de bytes enviados se a operação foi bem-sucedida.An asynchronous task that completes with number of bytes sent if the operation was successful. Caso contrário, a tarefa será concluída com um erro de soquete inválido.Otherwise, the task will complete with an invalid socket error.

Aplica-se a