From 288a6ebcadea5b41ef9bc3868b3959a6055f480f Mon Sep 17 00:00:00 2001 From: Efe Karasakal Date: Mon, 9 Mar 2026 18:23:41 +0100 Subject: [PATCH 1/2] doc: clarify socket.setKeepAlive initialDelay arg --- doc/api/net.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/net.md b/doc/api/net.md index f8cd3ccf8d3c40..c6321c3b38c7a7 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -1402,6 +1402,9 @@ data packet received and the first keepalive probe. Setting `0` for `initialDelay` will leave the value unchanged from the default (or previous) setting. +**Note:** Node.js converts `initialDelay` from milliseconds to seconds and truncates any fractional part. +For example, `1500` becomes `1`, and values from `1` to `999` become `0`. + Enabling the keep-alive functionality will set the following socket options: * `SO_KEEPALIVE=1` From e0814bc16ee7c6ca7c876bd11829ec55ba3189f6 Mon Sep 17 00:00:00 2001 From: Efe Karasakal Date: Sun, 29 Mar 2026 12:59:17 +0200 Subject: [PATCH 2/2] doc: better examples --- doc/api/net.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/api/net.md b/doc/api/net.md index c6321c3b38c7a7..e1de1958f4cf42 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -1402,8 +1402,9 @@ data packet received and the first keepalive probe. Setting `0` for `initialDelay` will leave the value unchanged from the default (or previous) setting. -**Note:** Node.js converts `initialDelay` from milliseconds to seconds and truncates any fractional part. -For example, `1500` becomes `1`, and values from `1` to `999` become `0`. +**Note**: Node.js converts initialDelay from milliseconds to seconds and truncates any fractional part. +For example, `setKeepAlive(true, 500)` does not update the delay because it is truncated to `0`, leaving the value +unchanged, while `setKeepAlive(true, 1500)` sets it to `1` second. Enabling the keep-alive functionality will set the following socket options: