Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Socket.EndReceiveMessageFrom Method

Note: This method is new in the .NET Framework version 2.0.

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
)
JScript does not support passing value-type arguments by reference.

Parameters

asyncResult

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

socketFlags

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

endPoint

The source EndPoint.

ipPacketInformation

The IPAddress and interface of the received packet.

Return Value

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

ArgumentNullException

asyncResult is a null reference (Nothing in Visual Basic)

-or-

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

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

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

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.