SocketTaskExtensions.ReceiveFromAsync 方法

定义

接收来自指定网络设备的数据。

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)

参数

socket
Socket

要对其执行 ReceiveFrom 操作的套接字。

buffer
ArraySegment<Byte>

Byte 类型的数组,它是接收的数据的存储位置。

socketFlags
SocketFlags

SocketFlags 值的按位组合。

remoteEndPoint
EndPoint

表示数据源的终结点。

返回

一个异步任务,完成时具有 SocketReceiveFromResult 结构。

例外

buffernull

remoteEPnull

尝试访问套接字时出错。

调用堆栈中的调用方没有所需的权限。

适用于