CURL.SetOptionTCPKeepAlive
--------------------------

Enable TCP keep-alive probing.

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

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

**MBS**( **"CURL.SetOptionTCPKeepAlive";** /\* Enable TCP keep-alive probing. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Value**) /\* The new setting. 1 = on and 0 = off.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |
| Value | The new setting. 1 = on and 0 = off. | 1 |

### Result

Returns OK or error.

### Description

Enable TCP keep-alive probing.  
If set to 1, TCP keep alive probes will be sent to avoid TCP/IP timeouts. The delay and frequency of these probes can be controlled by the [CURL.SetOptionTCPKeepIdle](CURLSetOptionTCPKeepIdle.md) and [CURL.SetOptionTCPKeepInterval](CURLSetOptionTCPKeepInterval.md) options, provided the operating system supports them. Set to 0 (default behavior) to disable keep alive probes.  
See also [TCP\_KEEPALIVE](https://curl.haxx.se/libcurl/c/CURLOPT_TCP_KEEPALIVE.html) option in CURL manual.

### Examples

Configure keep alive:

 #Enable TCP keep-alive for this transfer   
Set Variable \[$r ; Value:MBS ( "CURL.SetOptionTCPKeepAlive"; $curl ; 1 )\]  
\#keep-alive idle time to 60 seconds   
Set Variable \[$r ; Value:MBS ( "[CURL.SetOptionTCPKeepIdle](CURLSetOptionTCPKeepIdle.md)"; $curl ; 60 )\]  
\#interval time between keep-alive probes: 30 seconds   
Set Variable \[$r ; Value:MBS ( "[CURL.SetOptionTCPKeepInterval](CURLSetOptionTCPKeepInterval.md)"; $curl ; 30 )\]  
### See also

- [CURL.SetOptionTCPKeepCount](CURLSetOptionTCPKeepCount.md)
- [CURL.SetOptionTCPKeepIdle](CURLSetOptionTCPKeepIdle.md)
- [CURL.SetOptionTCPKeepInterval](CURLSetOptionTCPKeepInterval.md)

### Blog Entries

- [MBS FileMaker Plugin, version 15.1pr1](https://www.mbsplugins.de/archive/2025-02-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Translating Insert from URL options for CURL to MBS Plugin calls](https://www.mbsplugins.de/archive/2020-12-14/Translating_Insert_from_URL_op/monkeybreadsoftware_blog_filemaker)

Created 8th July 2015 , last changed 30th November 2021

  
[CURL.SetOptionTCPFastOpen](CURLSetOptionTCPFastOpen.md) - [CURL.SetOptionTCPKeepCount](CURLSetOptionTCPKeepCount.md)

[HTML Version](CURLSetOptionTCPKeepAlive.shtml)