SocketTaskExtensions.ReceiveMessageFromAsync Method

Definition

Receives the specified number of bytes of data into the specified location of the data buffer, using the specified SocketFlags, and stores the endpoint and packet information.

C#
public static System.Threading.Tasks.Task<System.Net.Sockets.SocketReceiveMessageFromResult> ReceiveMessageFromAsync(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 operation on.

buffer
ArraySegment<Byte>

An array that is the storage location for received data.

socketFlags
SocketFlags

A bitwise combination of the SocketFlags values.

remoteEndPoint
EndPoint

An EndPoint, that represents the remote server.

Returns

An asynchronous Task that completes with a SocketReceiveMessageFromResult struct.

Exceptions

The Socket object has been closed.

The remoteEndPoint is null.

You must call the Bind method before performing this operation.

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