Uredi

Deli z drugimi prek


SocketTaskExtensions.ReceiveFromAsync Method

Definition

Receives data from a specified network device.

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)

Parameters

socket
Socket

The socket to perform the ReceiveFrom operation on.

buffer
ArraySegment<Byte>

An array of type Byte that is the storage location for the received data.

socketFlags
SocketFlags

A bitwise combination of the SocketFlags values.

remoteEndPoint
EndPoint

An EndPoint that represents the source of the data.

Returns

An asynchronous Task that completes with a SocketReceiveFromResult struct.

Exceptions

buffer is null.

-or-

remoteEP is null.

An error occurred when attempting to access the socket.

The Socket has been closed.

A caller in the call stack does not have the required permissions.

Applies to