This documentation is archived and is not being maintained.

SocketAsyncEventArgs.Completed Event

The event used to complete an asynchronous operation.

Namespace:  System.Net.Sockets
Assembly:  System (in System.dll)

public event EventHandler<SocketAsyncEventArgs> Completed

The Completed event provides a way for client applications to complete an asynchronous socket operation. An event handler must be attached to the event within a SocketAsyncEventArgs instance when an asynchronous socket operation is initiated. The completion callback delegates referenced by the Completed event contains program logic to finish processing the asynchronous socket operation for the client.

When the event is signaled, the application uses the SocketAsyncEventArgs object parameter to obtain the status of the completed asynchronous socket operation.

Problems may occur if the SetBuffer method is called from a thread while the M:System.Net.Sockets.Socket.ReceiveAsync(System.Net.Sockets.SocketAsyncEventArgs)ReceiveAsync method is called from a different thread. These problems an be prevented by putting locks around these methods to keep the methods from being called at the same time.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5 SP1, 3.0 SP1, 2.0 SP1