Socket.EndReceiveMessageFrom Method
Ends a pending asynchronous read from a specific endpoint. This method also reveals more information about the packet than EndReceiveFrom.
Assembly: System (in System.dll)
'Declaration Public Function EndReceiveMessageFrom ( _ asyncResult As IAsyncResult, _ ByRef socketFlags As SocketFlags, _ ByRef endPoint As EndPoint, _ <OutAttribute> ByRef ipPacketInformation As IPPacketInformation _ ) As Integer 'Usage Dim instance As Socket Dim asyncResult As IAsyncResult Dim socketFlags As SocketFlags Dim endPoint As EndPoint Dim ipPacketInformation As IPPacketInformation Dim returnValue As Integer returnValue = instance.EndReceiveMessageFrom(asyncResult, _ socketFlags, endPoint, ipPacketInformation)
Parameters
- asyncResult
- Type: System.IAsyncResult
An IAsyncResult that stores state information and any user defined data for this asynchronous operation.
- socketFlags
- Type: System.Net.Sockets.SocketFlags%
A bitwise combination of the SocketFlags values for the received packet.
- endPoint
- Type: System.Net.EndPoint%
The source EndPoint.
- ipPacketInformation
- Type: System.Net.Sockets.IPPacketInformation%
The IPAddress and interface of the received packet.
Return Value
Type: System.Int32If successful, the number of bytes received. If unsuccessful, returns 0.
| Exception | Condition |
|---|---|
| ArgumentNullException | asyncResult is Nothing -or- endPoint is Nothing. |
| ArgumentException | asyncResult was not returned by a call to the BeginReceiveMessageFrom method. |
| InvalidOperationException | EndReceiveMessageFrom was previously called for the asynchronous read. |
| SocketException | An error occurred when attempting to access the socket. See the Remarks section for more information. |
| ObjectDisposedException | The Socket has been closed. |
If the operation has not completed, this method blocks until it does.
To perform this operation synchronously, use the ReceiveMessageFrom method.
Examine ipPacketInformation if you need to know if the datagram was sent using a unicast, multicast, or broadcast address.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.