OnDataAvailable Event (Windows 8)

 

Fired every time the client receives response data from the server.

C/C++ Syntax

HRESULT OnDataAvailable(  
        IXMLHTTPRequest2 *pXHR,  
        ISequentialStream *pResponseStream);  

Parameters

pXHR[in]
The IXMLHTTPRequest2 object associated with this callback.

pResponseStream[in]
The response stream being received. The client can call ISequentialStream::Read to begin processing the data, or it can wait until it has received the complete response. This response stream is wrapped in a stream synchronization object that prevents concurrent read and write operations, so the application does not need to implement custom synchronization.

Return Values

S_OK
The value returned if successful.

Remarks

When this event fires the application can begin processing data from the HTTP response, even if it has not yet received the entire response. Internally, IXMLHTTPRequest2 uses memory for all response data not yet read by the caller.

Custom streams receive a call to ISequentialStream::Write before OnDataAvailable is fired. The client can process data directly from the Write call instead of calling ISequentialStream::Read on the custom stream, and it can rely on the Write call to indicate that new data is available.

Versioning

Implemented in: MSXML 6.0

Applies to

IXMLHTTPRequest2 (Windows 8)

See Also

ISequentialStream::Read
ISequentialStream::Write