diff options
author | Andy Pan <i@andypan.me> | 2025-05-21 14:43:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-21 08:43:53 +0200 |
commit | 3a9a6e3e6bc78565ddf94cf462c9877c1004bb62 (patch) | |
tree | d684b2e44f5dc44ac608ca681422dc9f33c142a6 /docs/src | |
parent | 71ec5c0fcdd867b64c46ade1e0a6b59101281a4a (diff) | |
download | libuv-3a9a6e3e6bc78565ddf94cf462c9877c1004bb62.tar.gz libuv-3a9a6e3e6bc78565ddf94cf462c9877c1004bb62.zip |
tcp: support customizing TCP_KEEPINTVL and TCP_KEEPCNT
Implement `uv_tcp_keepalive_ex` function that extends
`uv_tcp_keepalive` to support `TCP_KEEPINTVL` and `TCP_KEEPCN`
socket options in addition to TCP_KEEPIDLE.
Diffstat (limited to 'docs/src')
-rw-r--r-- | docs/src/tcp.rst | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/docs/src/tcp.rst b/docs/src/tcp.rst index f9b203c4..a17ccba5 100644 --- a/docs/src/tcp.rst +++ b/docs/src/tcp.rst @@ -91,6 +91,35 @@ API .. versionchanged:: 1.49.0 If `delay` is less than 1 then ``UV_EINVAL``` is returned. +.. c:function:: int uv_tcp_keepalive_ex(uv_tcp_t* handle, int on, unsigned int idle, unsigned int intvl, unsigned int cnt) + + Enable / disable TCP keep-alive with all socket options: `TCP_KEEPIDLE`, `TCP_KEEPINTVL` and `TCP_KEEPCNT`. + `idle` is the value for `TCP_KEEPIDLE`, `intvl` is the value for `TCP_KEEPINTVL`, + `cnt` is the value for `TCP_KEEPCNT`, ignored when `on` is zero. + + With TCP keep-alive enabled, `idle` is the time (in seconds) the connection needs to remain idle before + TCP starts sending keep-alive probes. `intvl` is the time (in seconds) between individual keep-alive probes. + TCP will drop the connection after sending `cnt` probes without getting any replies from the peer, then the + handle is destroyed with a ``UV_ETIMEDOUT`` error passed to the corresponding callback. + + If one of `idle`, `intvl`, or `cnt` is less than 1, ``UV_EINVAL`` is returned. + + .. versionchanged:: 1.52.0 added support of setting `TCP_KEEPINTVL` and `TCP_KEEPCNT` socket options. + + .. note:: + Ensure that the socket options are supported by the underlying operating system. + Currently supported platforms: + - AIX + - DragonFlyBSD + - FreeBSD + - HP-UX + - illumos + - Linux + - macOS + - NetBSD + - Solaris + - Windows + .. c:function:: int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) Enable / disable simultaneous asynchronous accept requests that are |