CURL.SetOptionFreshConnect
--------------------------

Sets whether to not reuse old connections.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [2.5](newinversion25.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.SetOptionFreshConnect"; curl; Value ) 

**MBS**( **"CURL.SetOptionFreshConnect";** /\* Sets whether to not reuse old connections. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Value**) /\* Whether to not reuse old connection for next transfer.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |
| Value | Whether to not reuse old connection for next transfer. | 0 |

### Result

Returns "OK" on success.

### Description

Sets whether to not reuse old connections.  
Set to 1 to make the next transfer use a new (fresh) connection by force. If the connection cache is full before this connection, one of the existing connections will be closed as according to the selected or default policy. This option should be used with caution and only if you understand what it does. Set this to 0 to have libcurl attempt re-using an existing connection (default behavior).  
see also [CURL.SetOptionForbidReuse](CURLSetOptionForbidReuse.md).  
See also [FRESH\_CONNECT](https://curl.haxx.se/libcurl/c/CURLOPT_FRESH_CONNECT.html) option in CURL manual.

### Examples

Request a fresh connection:

 Set Variable \[$r ; Value: MBS ( "CURL.SetOptionFreshConnect"; $curl ; 1 )\]  
Forbit reuse and make fresh connection:

 Set Variable \[$EmailID ; Value: MBS ( "[CURL.SetOptionForbidReuse](CURLSetOptionForbidReuse.md)"; $curl ; 1 ) \]  
Set Variable \[$EmailID ; Value: MBS ( "CURL.SetOptionFreshConnect"; $curl ; 1 ) \]  
Require new connection every 20 emails:

 Set Variable \[ $r ; Value: MBS ("CURL.SetOptionFreshConnect"; $curl ; Mod ( GetAsNumber ( $count ) ; 20 ) = 0 \]  
### See also

- [CURL.SetOptionConnectionTimeout](CURLSetOptionConnectionTimeout.md)
- [CURL.SetOptionConnectOnly](CURLSetOptionConnectOnly.md)
- [CURL.SetOptionForbidReuse](CURLSetOptionForbidReuse.md)
- [CURL.SetOptionMaxConnects](CURLSetOptionMaxConnects.md)
- [CURL.SetOptionTimeOut](CURLSetOptionTimeOut.md)

### Example Databases

- [CURL/Batch Download](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Batch%20Download.shtml#7ScriptAnchor_)
- [CURL/Email/Batch Emailer](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Batch%20Emailer.shtml#1ScriptAnchor_)

Created 18th August 2014 , last changed 16th February 2024

  
[CURL.SetOptionForbidReuse](CURLSetOptionForbidReuse.md) - [CURL.SetOptionGSSAPIDelegation](CURLSetOptionGSSAPIDelegation.md)

[HTML Version](CURLSetOptionFreshConnect.shtml)