libcurl - CURLOPT_TCP_KEEPIDLE 和 CURLOPT_TCP_KEEPINTVL

libcurl - CURLOPT_TCP_KEEPIDLE and CURLOPT_TCP_KEEPINTVL

请告诉我参数之间有什么区别:CURLOPT_TCP_KEEPIDLE 和 CURLOPT_TCP_KEEPINTVL ?

CURLOPT_TCP_KEEPIDLE: Sets the delay, in seconds, that the operating system will wait while the connection is idle before sending keepalive probes. Not all operating systems support this option.

CURLOPT_TCP_KEEPINTVL: Sets the interval, in seconds, that the operating system will wait between sending keepalive probes. Not all operating systems support this option.

-我是这样理解的:CURLOPT_TCP_KEEPIDLE-这意味着 OS 在 OS 认为连接断开了?

-但我无法理解:CURLOPT_TCP_KEEPINTVL - 设置间隔...其中 OS 将等待 between .... Between什么?什么和什么之间的间隔?

TCP keep alive 在两个端点之间发送“keep alive”探测(小型 IP 包)。

如果一段时间内没有通过TCP 连接传输数据,TCP 端点将发送一个keep alive 探测。本期为CURLOPT_TCP_KEEPIDLE.

如果另一个端点仍然连接,另一个端点将回复保活探测。

如果另一个端点没有回复keep alive probe,TCP端点将在一定时间后发送另一个keep alive probe。本期是CURLOPT_TCP_KEEPINTVL.

TCP 端点将继续发送保持活动探测,直到另一个端点发送回复或已发送最大数量的保持活动探测。如果已发送最大数量的保持活动探测而另一端点没有回复,则 TCP 连接不再连接。