Export (0) Print
Expand All

SocketAsyncEventArgs.OnCompleted Method

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

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

protected virtual void OnCompleted(
	SocketAsyncEventArgs e
)

Parameters

e
Type: System.Net.Sockets.SocketAsyncEventArgs

The event that is signaled.

This method is not callable by user code. This method gets called by the internals of the SocketAsyncEventArgs object when the current operation is complete. This method is used with all asynchronous socket (xxxAsync) methods.

An application that creates a class inheriting from SocketAsyncEventArgs can override this method to hook into this completion notification and clean up any resources that it allocated for the operation. The default implementation just raises the Completed event.

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 (xxxAsync) methods on the System.Net.Sockets.Socket class.

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.

.NET Framework

Supported in: 4.5, 4, 3.5 SP1, 3.0 SP1, 2.0 SP1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft