SocketTaskExtensions.ReceiveAsync Método

Definição

Sobrecargas

ReceiveAsync(Socket, ArraySegment<Byte>, SocketFlags)

Recebe os dados de um soquete conectado.Receives data from a connected socket.

ReceiveAsync(Socket, IList<ArraySegment<Byte>>, SocketFlags)

Recebe os dados de um soquete conectado.Receives data from a connected socket.

ReceiveAsync(Socket, Memory<Byte>, SocketFlags, CancellationToken)

Recebe os dados de um soquete conectado.Receives data from a connected socket.

ReceiveAsync(Socket, ArraySegment<Byte>, SocketFlags)

Recebe os dados de um soquete conectado.Receives data from a connected socket.

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

Parâmetros

socket
Socket

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

buffer
ArraySegment<Byte>

Uma matriz que é o local de armazenamento dos dados recebidos.An array that is the storage location for the received data.

socketFlags
SocketFlags

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

Retornos

Task<Int32>

Uma tarefa que representa a operação de recebimento assíncrona.A task that represents the asynchronous receive operation. O valor do parâmetro TResult contém o número de bytes recebidos.The value of the TResult parameter contains the number of bytes received.

Aplica-se a

ReceiveAsync(Socket, IList<ArraySegment<Byte>>, SocketFlags)

Recebe os dados de um soquete conectado.Receives data from a connected socket.

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

Parâmetros

socket
Socket

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

buffers
IList<ArraySegment<Byte>>

Uma matriz que é o local de armazenamento dos dados recebidos.An array that is the storage location for the received data.

socketFlags
SocketFlags

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

Retornos

Task<Int32>

Uma tarefa que representa a operação de recebimento assíncrona.A task that represents the asynchronous receive operation. O valor do parâmetro TResult contém o número de bytes recebidos.The value of the TResult parameter contains the number of bytes received.

Aplica-se a

ReceiveAsync(Socket, Memory<Byte>, SocketFlags, CancellationToken)

Recebe os dados de um soquete conectado.Receives data from a connected socket.

public static System.Threading.Tasks.ValueTask<int> ReceiveAsync (this System.Net.Sockets.Socket socket, Memory<byte> buffer, System.Net.Sockets.SocketFlags socketFlags, System.Threading.CancellationToken cancellationToken = default);
static member ReceiveAsync : System.Net.Sockets.Socket * Memory<byte> * System.Net.Sockets.SocketFlags * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<int>
<Extension()>
Public Function ReceiveAsync (socket As Socket, buffer As Memory(Of Byte), socketFlags As SocketFlags, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Integer)

Parâmetros

socket
Socket

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

buffer
Memory<Byte>

Uma região de memória que é o local de armazenamento dos dados recebidos.A region of memory that is the storage location for the received data.

socketFlags
SocketFlags

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

cancellationToken
CancellationToken

Um token de cancelamento que pode ser usado para sinalizar que a operação assíncrona deve ser cancelada.A cancellation token that can be used to signal the asynchronous operation should be canceled.

Retornos

ValueTask<Int32>

Uma tarefa concluída com o número de bytes recebidos ou 0 se o fim do fluxo tiver sido atingido.A task that completes with the number of bytes received, or 0 if the end of the stream has been reached.

Aplica-se a