SocketTaskExtensions.ReceiveMessageFromAsync(Socket, ArraySegment<Byte>, SocketFlags, EndPoint) 方法

定义

使用指定的 SocketFlags 将指定字节数的数据接收到指定的数据缓冲区位置,并存储终结点和数据包信息。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)

参数

socket
Socket

要对其执行操作的套接字。The socket to perform the operation on.

buffer
ArraySegment<Byte>

一个数组,它是接收的数据的存储位置。An array that is the storage location for received data.

socketFlags
SocketFlags

SocketFlags 值的按位组合。A bitwise combination of the SocketFlags values.

remoteEndPoint
EndPoint

表示远程服务器的 EndPointAn EndPoint, that represents the remote server.

返回

一个异步任务,完成时具有 SocketReceiveMessageFromResult 结构。An asynchronous Task that completes with a SocketReceiveMessageFromResult struct.

适用于