Synchronous and Asynchronous I/O
This set of samples demonstrates how to perform both synchronous and asynchronous I/O operations from your ISAPI extension. Both flavors of I/O have been provided here for the sake of comparison, and each type of operation has its advantages. Asynchronous reads and writes are powerful extensions to ISAPI, as they allow extensions to free server pool threads from blocking on I/O operations. Even more importantly, asynchronous I/O takes advantage of the special pool of dedicated threads that IIS reserves for asynchronous I/O.
-
Synchronous Read: This sample, located in the SYNCREAD subdirectory, demonstrates simple, synchronous reads using the ISAPI callback function ReadClient. The DLL created from this project accepts input from the client browser, then sends it back to the browser as an HTML page.
-
Synchronous Write: This example, located in the SYNCWRITE subdirectory, illustrates how to use the callback function WriteClient to perform simple, synchronous writes. This extension, when compiled, sends the file specified in the URL query string back to the client browser synchronously.
-
Asynchronous Read: The sample illustrates how you can implement asynchronous reads in an ISAPI extension, using the callback ServerSupportFunction with the HSE_REQ_ASYNC_READ_CLIENT request. In addition, this sample submits a callback function and context of its own to the server by calling ServerSupportFunction with the request HSE_REQ_IO_COMPLETION. This sample is located in the ASYNCREAD subdirectory. This designates the function that IIS will call when the I/O operation has completed.
-
Asynchronous Write: This example, located in the ASYNCWRITE subdirectory, uses the callback function WriteClient, with the HSE_IO_ASYNC option set, to write asynchronously to the client browser. This sample also submits a callback function and context to the server by calling ServerSupportFunction with the request HSE_REQ_IO_COMPLETION. This designates the function that IIS will call when the I/O operation has completed.
-
Asynchronous Transmit: This sample demonstrates the use of the Win32 TransmitFile function to send a message asynchronously. This sample calls the ServerSupportFunction with the HSE_REQ_TRANSMIT_FILE request. It also specifies the callback function, to be called by IIS when the I/O operation has completed, in the HSE_TF_INFO structure that is passed along with the transmission request. This sample is located in the ASYNCTRANS subdirectory.
These samples are provided for educational purposes only. They have not been tested in a production environment, and Microsoft® will not provide technical support for them.
These projects are available in the ...\iissamples\sdk\isapi\extensions\io subdirectory of the Internet services directory.
© 1997 by Microsoft Corporation. All rights reserved.