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

System.Net.Sockets.NetworkStream.EndWrite Method

Ends an asynchronous call to write data to the current instance.

public override void EndWrite (IAsyncResult ar)

Parameters

ar
A IAsyncResult object that holds the state information for the asynchronous operation.

Exceptions

TypeReason
ArgumentNullExceptionasyncResult is null.
System.IO.IOException
Note: This method catches all exceptions thrown by the Socket.EndSend(IAsyncResult) method.
ObjectDisposedExceptionThe current instance has been disposed.

Remarks

This method blocks if the asynchronous operation has not completed.

The NetworkStream.EndWrite(IAsyncResult) method completes an asynchronous request that was started with a call to the NetworkStream.BeginWrite(Byte[], int, int, AsyncCallback, object) method. The object specified for the asyncResult parameter is required to be the same object as was returned by the NetworkStream.BeginWrite(Byte[], int, int, AsyncCallback, object) method call that began the request.

If the NetworkStream.EndWrite(IAsyncResult) method is invoked via the AsyncCallback delegate specified to the NetworkStream.BeginWrite(Byte[], int, int, AsyncCallback, object) method, the asyncResult parameter is the IAsyncResult argument passed to the delegate's method.

Note:

This method overrides System.IO.Stream.EndWrite(IAsyncResult).

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