Mentalis.org Security Library documentation

VirtualSocket.EndReceiveFrom Method 

Ends a pending asynchronous read from a specific endpoint.

[Visual Basic]
Overridable Public Function EndReceiveFrom( _
   ByVal asyncResult As IAsyncResult, _
   ByRef endPoint As EndPoint _
) As Integer
[C#]
public virtual int EndReceiveFrom(
   IAsyncResult asyncResult,
   ref EndPoint endPoint
);

Parameters

asyncResult
Stores state information for this asynchronous operation as well as any user defined data.
endPoint
The source EndPoint.

Return Value

If successful, the number of bytes received. If unsuccessful, returns 0 if the connection is closed by the remote host.

Remarks

To maintain the asynchronous nature of the operation, call this method from the callback delegate. You can pass either the IAsyncResult returned from BeginReceiveFrom or the callback delegate used as an input parameter to BeginReceiveFrom. as the asyncResult parameter. The EndReceiveFrom method frees any resources allocated by the BeginReceiveFrom method. The EndReceiveFrom method blocks until read ends.

Exceptions

Exception TypeCondition
ArgumentNullExceptionasyncResult is a null reference (Nothing in Visual Basic).
ArgumentExceptionasyncResult was not returned by a call to the BeginReceiveFrom method.
InvalidOperationExceptionEndReceiveFrom was previously called for the asynchronous read.
SocketExceptionAn operating system error occurs while accessing the VirtualSocket.
ObjectDisposedExceptionThe VirtualSocket has been closed.

See Also

VirtualSocket Class | VirtualSocket Members | Org.Mentalis.Security.Ssl Namespace