The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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
public int EndReceiveMessageFrom (
	IAsyncResult asyncResult, 
	/** @ref */ SocketFlags socketFlags, 
	/** @ref */ EndPoint endPoint, 
	/** @attribute OutAttribute() */ /** @ref */ IPPacketInformation ipPacketInformation
Not applicable.



An IAsyncResult that stores state information and any user defined data for this asynchronous operation.


A bitwise combination of the SocketFlags values for the received packet.


The source EndPoint.


The IPAddress and interface of the received packet.

Return Value

If successful, the number of bytes received. If unsuccessful, returns 0.

Exception typeCondition


asyncResult is a null reference (Nothing in Visual Basic)


endPoint is a null reference (Nothing in Visual Basic).


asyncResult was not returned by a call to the BeginReceiveMessageFrom method.


EndReceiveMessageFrom was previously called for the asynchronous read.


An error occurred when attempting to access the socket. See the Remarks section for more information.


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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft