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

CURL.SetOptionMaxLifeTimeConnection

Sets maximum lifetime (since creation) allowed for reusing a connection.

Component Version macOS Windows Linux Server iOS SDK
CURL 12.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.SetOptionMaxLifeTimeConnection"; curl; value )   More

Parameters

Parameter Description Example
curl The CURL session handle. $curl
value The new maximum lifetime for a connection in seconds. 300

Result

Returns OK or error.

Description

Sets maximum lifetime (since creation) allowed for reusing a connection.
Pass a number as parameter containing maxlifetime - the maximum time in seconds, since the creation of the connection, that you allow an existing connection to have to be considered for reuse for this request.

libcurl features a connection cache that holds previously used connections. When a new request is to be done, it will consider any connection that matches for reuse. The MaxLifeTimeConnection limit prevents libcurl from trying too old connections for reuse. This can be used for client-side load balancing. If a connection is found in the cache that is older than this set maxlifetime, it will instead be closed once any in-progress transfers complete.

If set to 0, this behavior is disabled: all connections are eligible for reuse.

Release notes

Blog Entries

Created 22nd August 2022, last changed 22nd August 2022


CURL.SetOptionMaxFileSize - CURL.SetOptionMaxRecvSpeed