|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Internet and Network > HTP. - Command > !HTP-General - General HTTP operations and utilities > !Configuration - Commands for setting up HTTP environment (timeouts, headers, proxy) > HTP. - HTTP Operations |
SPR Script Language
HTP.SetTO
Sets the timeout for HTTP operations in milliseconds.
Intention
The HTP.SetTO command in SPR configures the timeout duration for HTTP operations, such as those performed by HTP.Request or HTP.ReqShort. You specify the timeout in milliseconds ($$MST), or omit it to reset to the default timeout. This helps control how long your script waits for HTTP responses before failing.
It’s your robot’s patience adjuster—HTP.SetTO sets how long it waits for the web to reply.
Illustration
⏱️ Set Timeout: HTP.SetTO|5000 sets a 5-second timeout.
🔄 Reset: HTP.SetTO restores the default timeout.
Syntax
HTP.SetTO|$$MST
Parameter Explanation
P1 - $$MST - (Variable, Numeric, Optional)
The timeout value in milliseconds (e.g., $$MST as "5000"). If -1 or missing, resets to the last used timeout stored in g_timeout.
Examples
'***********************************
' HTP.SetTO - Sample 1: Set 5-Second Timeout
'***********************************
HTP.SetTO|5000
MBX.Timeout set to 5 seconds
HTP.Request|GET|https://example.com|||0|0|0|$$RES
MBX.Ready
'
'***********************************
' HTP.SetTO - Sample 2: Reset to Default
'***********************************
HTP.SetTO
PRT.Timeout reset to default
MBX.Ready
'
Remarks
- Sets the timeout for all subsequent HTTP operations.
- Omitting $$MST resets to the default stored in g_timeout.
- Affects commands like HTP.Request and HTP.ReqShort.
Limitations
- No confirmation of success; assumes HTP_SetTimeout works.
- Default timeout depends on initial g_timeout value.
See also: