waitForResponse Method
Allows the requesting server to suspend execution while waiting for an asynchronous send operation to complete.
[Script]
Script Syntax
oServerXMLHTTPRequest.waitForResponse(timeoutInSeconds);
Parameters
- timeoutInSeconds (optional)
- Specifies the number of seconds to wait for an asynchronous send operation to complete.
Example
var xmlServerHttp = new ActiveXObject("Msxml2.ServerXMLHTTP.5.0"); xmlServerHttp.open("GET", "http://localhost/sample.xml", true); xmlServerHttp.send(); while (xmlServerHttp.readyState != 4) { xmlServerHttp.waitForResponse(1000); }
[Visual Basic]
Visual Basic Syntax
oServerXMLHTTPRequest.waitForResponse(timeoutInSeconds)
Parameters
- timeoutInSeconds (optional)
- Specifies the number of seconds to wait for an asynchronous send operation to complete.
Example
Dim xmlServerHttp As New Msxml2.ServerXMLHTTP50 xmlServerHttp.open "GET", "http://localhost/sample.xml", True xmlServerHttp.send While xmlServerHttp.readyState <> 4 xmlServerHttp.waitForResponse 1000 Wend
[C/C++]
C/C++ Syntax
HRESULT waitForResponse(VARIANT timeoutInSeconds, VARIANT_BOOL * isSuccessful);
Parameters
- timeoutInSeconds [in, optional]
- Specifies the number of seconds to wait for an asynchronous send operation to complete.
- isSuccessful [out, retval]
- The
waitForResponse
method is more efficient than polling thereadyState
property, which is the only way to wait for an asynchronous send using theXMLHTTP
component. The caller can supply an optionaltimeout
parameter, specified in seconds. The default timeout (if one is not specified) is INFINITE (-1). The method returns True if a response is received within the time allotted, or False if a timeout occurs. If the method times out, the request is not aborted; the caller can continue to wait for the request in a subsequent call to thewaitForResponse
method. CallingwaitForResponse
after a synchronoussend
method returns immediately and has no useful effect. Theasync
parameter to theopen
method controls whether the send is synchronous (default) or asynchronous. The results of this method are valid only after thesend
method has been completed successfully.
C/C++ Return Values
- S_OK
- The value returned if successful.
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button in the upper-left corner of the page.
See Also
open Method | readyState Property | send Method
Applies to: IServerXMLHTTPRequest/ServerXMLHTTP