Redigera

Dela via


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.

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

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