Appends one or more HTTP_DATA_CHUNK structures to the response body.
[IN] A pointer to one or more HTTP_DATA_CHUNK structures.
[IN] A DWORD that contains the number of chunks pointed to by pDataChunks.
[IN] true if the method should complete asynchronously; otherwise, false.
[IN] true if more data is to be sent in the response; false if this is the last data.
[OUT] The number of bytes that were sent to the client if the call completes synchronously.
[OUT] true if an asynchronous completion is pending for this call; otherwise, false.
An HRESULT. Possible values include, but are not limited to, those in the following table.
Indicates that the operation was successful.
Indicates that the parameter is not valid (for example, the pDataChunks pointer is set to NULL).
Indicates that there is insufficient memory to perform the operation.
More than 65535 chunks have been added to the response.
Developers can use the WriteEntityChunks method to insert a single HTTP_DATA_CHUNK structure or an array of HTTP_DATA_CHUNK structures into the response body. If the operation has completed synchronously, the pcbSent parameter will receive the number of bytes that were inserted into the response.
If buffering is turned on, the WriteEntityChunks method will create a copy of any HTTP_DATA_CHUNK structures, thereby duplicating the underlying data so that it does not need to be preserved. If buffering is turned off, or the response buffer limit is reached, the WriteEntityChunks method will also flush the response. If buffering is off and the fAsync parameter is true, the memory must be preserved until the request completes.
You can configure a WriteEntityChunks operation to complete asynchronously by setting the fAsync parameter to true. In this situation, the WriteEntityChunks method will return immediately to the caller, and the pcbSent parameter will not receive the number of bytes that were inserted into the response. If buffering is disabled and the fAsync parameter is true, the memory for the pDataChunks parameter must be persisted until the asynchronous call completes.
A maximum of 65535 chunks (64 KB minus 1) can be written to a request.
The following example demonstrates how to use the WriteEntityChunks method to create an HTTP module that inserts an array of two data chunks into the response. The example then returns the response to a Web client.