Generally, if you use asynchronous I/O operations in your ISAPI extension, then you must provide a special asynchronous callback function of type PFN_HSE_IO_COMPLETION. Unlike the other callback functions, this function must be provided and exposed by your extension, and will be called by IIS. When IIS completes an asynchronous read or write that your extension requested, IIS calls your callback function. The function can be used to read or write more data, or perform necessary resource de-allocation and cleanup.
VOID WINAPI * PFN_HSE_IO_COMPLETION_CALLBACK (
LPEXTENSION_CONTROL_BLOCK lpECB,
PVOID pContext,
DWORD cbIO,
DWORD dwError
);
If the asynchronous I/O operation was a read operation, and the cbIO parameter indicates that zero bytes were read, then you can assume that the client has closed the connection.
If there is no more work to be done for the current request, this function should clean up the state and notify IIS that the request has ended by using the HSE_REQ_DONE_WITH_SESSION support function.
The error code, specified by the parameter dwError, contains any Win32 error code generated by the asynchronous I/O operation. In addition to the typical Win32 network error codes, there are several special values which are important. If your ISAPI extension has used the HSE_REQ_CLOSE_CONNECTION function of ServerSupportFunction, the error ERROR_NETNAME_DELETED will be set. If the connection was broken from the client side, however, the error ERROR_OPERATION_ABORTED will be used.