Skip to content

Commit

Permalink
doc: document new TCP_KEEPCNT and TCP_KEEPINTVL socket option defaults
Browse files Browse the repository at this point in the history
PR #32204 introduced new defaults for
the TCP keep-alive socket options (see deps/uv/src/unix/tcp.c):
- "TCP_KEEPCNT" now defaults to 10 on all platforms
- "TCP_KEEPINTVL" now defaults to 1 on all platforms

Previously, "TCP_KEEPCNT" and "TCP_KEEPINTVL" were not set explicitly
and OS-default values were used.

Fixes: #38298
Refs: #32204

PR-URL: #38313
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
ArnoldZokas authored and targos committed Jun 11, 2021
1 parent dcdbaff commit ba117c2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions doc/api/net.md
Expand Up @@ -873,6 +873,12 @@ Set the encoding for the socket as a [Readable Stream][]. See
### `socket.setKeepAlive([enable][, initialDelay])`
<!-- YAML
added: v0.1.92
changes:
- version:
- v13.12.0
- v12.17.0
pr-url: https://github.com/nodejs/node/pull/32204
description: New defaults for `TCP_KEEPCNT` and `TCP_KEEPINTVL` socket options were added.
-->

* `enable` {boolean} **Default:** `false`
Expand All @@ -887,6 +893,12 @@ data packet received and the first keepalive probe. Setting `0` for
`initialDelay` will leave the value unchanged from the default
(or previous) setting.

Enabling the keep-alive functionality will set the following socket options:
* `SO_KEEPALIVE=1`
* `TCP_KEEPIDLE=initialDelay`
* `TCP_KEEPCNT=10`
* `TCP_KEEPINTVL=1`

### `socket.setNoDelay([noDelay])`
<!-- YAML
added: v0.1.90
Expand Down

0 comments on commit ba117c2

Please sign in to comment.