Help Center

CWinHttpRequest.SetTimeoutsmethod

Specifies the individual time-out components of a send/receive operation, in milliseconds.

COMmethoddocumented

Syntax

FUNCTION SetTimeouts (BYVAL ResolveTimeout AS LONG, BYVAL ConnectTimeout AS LONG, BYVAL SendTimeout AS LONG, BYVAL ReceiveTimeout AS LONG) AS HRESULT

Parameters

NameDescription
ResolveTimeoutTime-out value applied when resolving a host name (such as www.microsoft.com) to an IP address (such as 192.168.131.199), in milliseconds. The default value is zero, meaning no time-out (infinite). If DNS timeout is specified using NAME_RESOLUTION_TIMEOUT, there is an overhead of one thread per request.
ConnectTimeoutTime-out value applied when establishing a communication socket with the target server, in milliseconds. The default value is 60,000 (60 seconds).
SendTimeoutTime-out value applied when sending an individual packet of request data on the communication socket to the target server, in milliseconds. A large request sent to an HTTP server are normally be broken up into multiple packets; the send time-out applies to sending each packet individually. The default value is 30,000 (30 seconds).
ReceiveTimeoutTime-out value applied when receiving a packet of response data from the target server, in milliseconds. Large responses are be broken up into multiple packets; the receive time-out applies to fetching each packet of data off the socket. The default value is 30,000 (30 seconds).

Return value

Returns S_OK (0) if successful or an error value otherwise.

Description

Specifies the individual time-out components of a send/receive operation, in milliseconds.

Remarks

All parameters are required. A value of 0 or -1 sets a time-out to wait infinitely. A value greater than 0 sets the time-out value in milliseconds. For example, 30,000 would set the time-out to 30 seconds. All negative values other than -1 cause this method to fail.

Time-out values are applied at the Winsock layer.

Reference

  • Defined in AfxNova/CWinHttpRequest.inc:498
  • Documented in COM/CWinHttpRequest Class.md
  • Topic: CWinHttpRequest Class