The ReadClient function reads data from the body of the client's HTTP request.
BOOL ReadClient(
HCONN hConn,
LPVOID lpvBuffer,
LPDWORD lpdwSize
);
If the function succeeds, the return value is TRUE. If an error occurs, the return value is FALSE. The Win32® GetLastError function can be called to determine the error.
The ReadClient function reads information from the body of the Web client's HTTP request into the buffer supplied by the caller. Thus, the call can be used to read data from an HTML form that uses the POST method.
It is not necessary to call ReadClient unless the EXTENSION_CONTROL_BLOCK member cbTotalBytes is larger than cbAvailable (also in the EXTENSION_CONTROL_BLOCK). If the buffer size that your extension has allocated, specified by lpdwSize, is less than the number of bytes available, as specified by the EXTENSION_CONTROL_BLOCK member cbAvailable, then your ReadClient call will return immediately with the requested amount of data. Your extension will need to call ReadClient multiple times to retrieve all the data. If the buffer size is greater than the number of bytes available, ReadClient will fill the available space.
Important ReadClient will time out after 60 seconds, regardless of any IIS server timeout settings. If you expect that the client of your ISAPI extension will regularly take more than 60 seconds to respond to a read, then you should performs asynchronous reads through the HSE_REQ_ASYNC_READ_CLIENT ServerSupportFunction, instead of synchronous ReadClient calls. Asynchronous read requests make better use of the IIS I/O thread pool, and can have timeout times regulated using the connection timeout value, accessible in the MMC.
Alternatively, if you are unable to use asynchronous reads, you can loop by initiating another synchronous ReadClient call after the 60-second timeout period has elapsed.
If the socket on which the server is listening to the client is closed, ReadClient will return TRUE, but with zero bytes read.