SocketAsyncEventArgs.OnCompleted Method

Represents a method that is called when an asynchronous operation completes.

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

protected virtual void OnCompleted(
	SocketAsyncEventArgs e


Type: System.Net.Sockets.SocketAsyncEventArgs
The event that is signaled.

This method is used to hook up an event handler to be used as the completion callback for a subsequent asynchronous socket operation. The caller must implement at least one callback delegate inherited from this method prior to starting an asynchronous socket operation using one of the asynchronous methods on the System.Net.Sockets.Socket class: Socket.ConnectAsync, Socket.ReceiveAsync, and Socket.SendAsync.

The caller's OnCompleted method provides a way for client applications to complete an asynchronous socket operation. A callback delegate must be implemented when an asynchronous socket operation is initiated. The completion callback delegate(s) inherited from the OnCompleted method must contain program logic to finish processing the asynchronous socket operation for the client.

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

This method is used with all asynchronous socket methods: Socket.ConnectAsync, Socket.ReceiveAsync, and Socket.SendAsync.


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions