Mono Class Library: System.Net.Sockets.Socket Overview | Members

System.Net.Sockets.Socket.EndSendTo Method

Ends an asynchronous call to send data to a socket associated with a specified endpoint. [Edit]

public int EndSendTo (IAsyncResult result)

Parameters

result
A IAsyncResult object that holds the state information for the asynchronous operation. [Edit]

Returns

A int containing the number of bytes sent. [Edit]

Exceptions

TypeReason
ArgumentNullExceptionasyncResult is null. [Edit]
ArgumentExceptionasyncResult was not returned by the current instance from a call to the Socket.SendTo(Byte[], int, int, SocketFlags, System.Net.EndPoint) method. [Edit]
InvalidOperationExceptionSocket.EndSendTo(IAsyncResult) was previously called for this operation. [Edit]
System.Net.Sockets.SocketException
Note: For additional information on causes of the SocketException, see the System.Net.Sockets.SocketException class.
[Edit]
ObjectDisposedExceptionThe current instance has been disposed. [Edit]

Remarks

This method blocks if the asynchronous operation has not completed.

The Socket.EndSendTo(IAsyncResult) method completes an asynchronous request that was started with a call to the Socket.BeginSendTo(Byte[], int, int, SocketFlags, System.Net.EndPoint, AsyncCallback, object) method. The object specified for the asyncResult parameter is required to be the same object as was returned by the Socket.BeginSendTo(Byte[], int, int, SocketFlags, System.Net.EndPoint, AsyncCallback, object) method call that began the request.

If the Socket.EndSendTo(IAsyncResult) method is invoked via the AsyncCallback delegate specified to the Socket.BeginSendTo(Byte[], int, int, SocketFlags, System.Net.EndPoint, AsyncCallback, object) method, the asyncResult parameter is the IAsyncResult argument passed to the delegate's method.

[Edit]

Example

For an outline of an asynchronous operation, see the Socket.BeginAccept(AsyncCallback, object) method. For the complete example, see the System.Net.Sockets.Socket class overview.

Requirements

Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0