SocketTaskExtensions.ReceiveFromAsync Method

Definition

Receives data from a specified network device.

C#
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);

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-

remoteEndPoint 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

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1