Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

CURL.SetOptionTimeOut

Sets the maximum time in seconds that you allow the transfer operation to take.

Component Version macOS Windows Linux Server iOS SDK
CURL 2.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.SetOptionTimeOut"; curl; Value )   More

Parameters

Parameter Description Example
curl The CURL session handle. $curl
Value Timeout it seconds. 60

Result

Returns "OK" on success.

Description

Sets the maximum time in seconds that you allow the transfer operation to take.
Normally, name lookups can take a considerable time and limiting operations to less than a few minutes risk aborting perfectly normal operations. This option will cause curl to use the SIGALRM to enable time-outing system calls.

See also TIMEOUT option in CURL manual.

Examples

Sets timeout to one minute:

MBS( "CURL.SetOptionTimeOut"; $curl; 60 )

Try whether google is available:

Let ( [
# new session
curl = MBS("CURL.New");
# only connect, don't transfer data
r = MBS("CURL.SetOptionConnectOnly"; curl; 1);
# limit time to 1 second to connect and 2 seconds in total
r = MBS("CURL.SetOptionConnectionTimeout"; curl; 1);
r = MBS("CURL.SetOptionTimeOut"; curl; 2);
# new connection please
r = MBS("CURL.SetOptionFreshConnect"; curl; 1);
r = MBS("CURL.SetOptionForbidReuse"; curl; 1);
# we query google here
r = MBS("CURL.SetOptionURL"; curl; "http://www.google.de");
# and try it!
result = MBS("CURL.Perform"; curl);
# optionally have log messages go there
// $$log = MBS("CURL.GetDebugMessages"; curl);
# and cleanup
r = MBS("CURL.Release"; curl)
]; result )

See also

Blog Entries

Created 18th August 2014, last changed 1st December 2022


CURL.SetOptionTimeCondition - CURL.SetOptionTimeValue