ReadClient

The ReadClient function reads data from the body of the client's HTTP request.

BOOL ReadClient(
  HCONN hConn,       
  LPVOID lpvBuffer,  
  LPDWORD lpdwSize   
);
 

Parameters

hConn
[in] A connection handle.
lpvBuffer
[out] Points to the buffer area to receive the requested information.
lpdwSize
[in/out] Points to a DWORD that indicates the number of bytes available in the buffer. On return, lpdwSize will contain the number of bytes actually transferred into the buffer.

Return Values

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.

Remarks

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. If more than lpdwSize bytes are immediately available to be read, ReadClient will block until some amount of data has been returned, and will return with less than the requested amount of data. In order to ensure that all data has been read, your program should call ReadClient in a loop which continues to run until the amount of data specified in lpdwSize has been read. If the socket on which the server is listening to the client is closed, ReadClient will return TRUE, but with zero bytes read. It is not necessary to call ReadClient unless cbTotalBytes is larger than cbAvailable. CbTotalBytes and cbAvailable are members of the EXTENSION_CONTROL_BLOCK structure for the request. These values are initialized when an ISAPI entry point is called.

If the size specified in lpdwSize is greater than the number of bytes available to be read, it is possible ReadClient will block until the data arrives.