Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
13.4
13.5
Statistic
FMM
Blog
Sets the connection timeout in seconds.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
CURL | 2.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example |
---|---|---|
curl | The CURL session handle. | $curl |
Value | The connection timeout time in seconds. | 300 |
Returns "OK" on success.
See also CONNECTTIMEOUT option in CURL manual.
Set timeout to 30 seconds:
MBS( "CURL.SetOptionConnectionTimeout"; $curl; 30 )
Check if SMB (port 445) is open on a given IP in network:
Let ( [
curl = MBS("CURL.New");
a = MBS( "CURL.SetOptionConnectOnly"; curl; 1 );
b = MBS( "CURL.SetOptionURL"; curl; "192.168.2.117" );
c = MBS( "CURL.SetOptionConnectionTimeout"; curl; 1 );
d = MBS( "CURL.SetOptionPort"; curl; 445 );
r = MBS( "CURL.Perform"; curl );
x = MBS( "CURL.Release"; curl)
]; r )
// returns either
// OK
// or
// 28: Connection timed out after 1000 milliseconds
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 )
Created 18th August 2014, last changed 3th January 2023