Socket.EndReceiveMessageFrom(IAsyncResult, SocketFlags, EndPoint, IPPacketInformation) Socket.EndReceiveMessageFrom(IAsyncResult, SocketFlags, EndPoint, IPPacketInformation) Socket.EndReceiveMessageFrom(IAsyncResult, SocketFlags, EndPoint, IPPacketInformation) Socket.EndReceiveMessageFrom(IAsyncResult, SocketFlags, EndPoint, IPPacketInformation) Method

定义

结束挂起的、从特定终结点进行异步读取。Ends a pending asynchronous read from a specific endpoint. 此方法还显示有关数据包而不是 EndReceiveFrom(IAsyncResult, EndPoint) 的更多信息。This method also reveals more information about the packet than EndReceiveFrom(IAsyncResult, EndPoint).

public:
 int EndReceiveMessageFrom(IAsyncResult ^ asyncResult, System::Net::Sockets::SocketFlags % socketFlags, System::Net::EndPoint ^ % endPoint, [Runtime::InteropServices::Out] System::Net::Sockets::IPPacketInformation % ipPacketInformation);
public int EndReceiveMessageFrom (IAsyncResult asyncResult, ref System.Net.Sockets.SocketFlags socketFlags, ref System.Net.EndPoint endPoint, out System.Net.Sockets.IPPacketInformation ipPacketInformation);
member this.EndReceiveMessageFrom : IAsyncResult *  *  *  -> int
Public Function EndReceiveMessageFrom (asyncResult As IAsyncResult, ByRef socketFlags As SocketFlags, ByRef endPoint As EndPoint, ByRef ipPacketInformation As IPPacketInformation) As Integer

参数

asyncResult
IAsyncResult IAsyncResult IAsyncResult IAsyncResult

IAsyncResult,它存储此异步操作的状态信息以及所有用户定义的数据。An IAsyncResult that stores state information and any user defined data for this asynchronous operation.

socketFlags
SocketFlags SocketFlags SocketFlags SocketFlags

所接收数据包的 SocketFlags 值的按位组合。A bitwise combination of the SocketFlags values for the received packet.

endPoint
EndPoint EndPoint EndPoint EndPoint

EndPointThe source EndPoint.

ipPacketInformation
IPPacketInformation IPPacketInformation IPPacketInformation IPPacketInformation

所接收数据包的 IPAddress 和接口。The IPAddress and interface of the received packet.

返回

如果成功,则返回已接收的字节数。If successful, the number of bytes received. 如果不成功,则返回 0。If unsuccessful, returns 0.

异常

asyncResultnullasyncResult is null

- 或 --or- endPointnullendPoint is null.

尝试访问套接字时出错。An error occurred when attempting to access the socket.

注解

如果该操作未完成,此方法阻止,直至它。If the operation has not completed, this method blocks until it does.

若要以同步方式执行此操作,请使用ReceiveMessageFrom方法。To perform this operation synchronously, use the ReceiveMessageFrom method.

检查ipPacketInformation如果您需要了解是否使用单播、 多播或广播地址发送数据报。Examine ipPacketInformation if you need to know if the datagram was sent using a unicast, multicast, or broadcast address.

适用于