setTimeouts Method
Specifies timeout settings for resolving the domain name, establishing the connection to the server, sending the data, and receiving the response. The timeout parameters of the setTimeouts method are specified in milliseconds, so a value of 1000 would represent 1 second. A value of zero represents an infinite timeout. There are four separate timeout parameters: resolveTimeout, connectTimeout, sendTimeout, and receiveTimeout. When calling the setTimeouts method, all four values must be specified. The timeouts are applied at the Winsock layer.
JScript Syntax
oServerXMLHTTPRequest.setTimeouts(resolveTimeout, connectTimeout,
sendTimeout, receiveTimeout);
Parameters
resolveTimeout
A long integer. The value is applied to mapping host names (such as "www.microsoft.com") to IP addresses; the default value is infinite, meaning no timeout.
connectTimeout
A long integer. The value is applied to establishing a communication socket with the target server, with a default timeout value of 60 seconds.
sendTimeout
A long integer. The value applies to sending an individual packet of request data (if any) on the communication socket to the target server. A large request sent to a server will normally be broken up into multiple packets; the send timeout applies to sending each packet individually. The default value is 30 seconds.
receiveTimeout
A long integer. The value applies to receiving a packet of response data from the target server. Large responses will be broken up into multiple packets; the receive timeout applies to fetching each packet of data off the socket. The default value is 30 seconds.
Example
var xmlServerHttp = new ActiveXObject("Msxml2.ServerXMLHTTP.6.0");
var lResolve = 5 * 1000;
var lConnect = 5 * 1000;
var lSend = 15 * 1000;
var lReceive = 15 * 1000;
xmlServerHttp.setTimeouts(lResolve, lConnect, lSend, lReceive);
xmlServerHttp.open("GET", "https://localhost/sample.xml", false);
xmlServerHttp.send();
C/C++ Syntax
HRESULT setTimeouts (long resolveTimeout, long connectTimeout,
long sendTimeout, long receiveTimeout)
Parameters
resolveTimeout
[in]
A long integer. The value is applied to mapping host names (such as "www.microsoft.com") to IP addresses; the default value is infinite, meaning no timeout.
connectTimeout
[in]
A long integer. The value is applied to establishing a communication socket with the target server, with a default timeout value of 60 seconds.
sendTimeout
[in]
A long integer. The value applies to sending an individual packet of request data (if any) on the communication socket to the target server. A large request sent to a server will normally be broken up into multiple packets; the send timeout applies to sending each packet individually. The default value is 30 seconds.
receiveTimeout
[in]
A long integer. The value applies to receiving a packet of response data from the target server. Large responses will be broken up into multiple packets; the receive timeout applies to fetching each packet of data off the socket. The default value is 30 seconds.
Return Values
S_OK
Value returned if successful.
Remarks
The setTimeouts
method should be called before the open
method. None of the parameters is optional.
Versioning
Implemented in: MSXML 3.0 and MSXML 6.0
See Also
open Method (ServerXMLHTTP-IServerXMLHTTPRequest)
IServerXMLHTTPRequest-ServerXMLHTTP