Socket.EndReceiveMessageFrom Method

Ends a pending asynchronous read from a specific endpoint. This method also reveals more information about the packet than EndReceiveFrom.

Namespace:  System.Net.Sockets
Assembly:  System (in System.dll)

public int EndReceiveMessageFrom(
	IAsyncResult asyncResult,
	ref SocketFlags socketFlags,
	ref EndPoint endPoint,
	out IPPacketInformation 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.Int32
If successful, the number of bytes received. If unsuccessful, returns 0.

ExceptionCondition
ArgumentNullException

asyncResult is null

-or-

endPoint is null.

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.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft