SocketTaskExtensions.ReceiveFromAsync Metodo

Definizione

Riceve i dati da un dispositivo di rete specificato.

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

Parametri

socket
Socket

Socket su cui eseguire l'operazione ReceiveFrom.

buffer
ArraySegment<Byte>

Matrice di tipo Byte che rappresenta il percorso di archiviazione per i dati ricevuti.

socketFlags
SocketFlags

Combinazione bit per bit dei SocketFlags valori.

remoteEndPoint
EndPoint

EndPoint che rappresenta l'origine dei dati.

Valori restituiti

Attività asincrona che viene completata con uno struct SocketReceiveFromResult.

Eccezioni

buffer è null.

oppure

remoteEndPoint è null.

Si è verificato un errore durante il tentativo di accesso al socket.

L'oggetto Socket è stato chiuso.

Un chiamante nello stack di chiamate non dispone delle autorizzazioni necessarie.

Si applica a