SocketAsyncEventArgs.OnCompleted Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Represents a method that is called when an asynchronous operation completes.
Assembly: System.Net (in System.Net.dll)
Parameters
- 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.