From 7c1e1156fd3b9de599fe0fba4437bd0970f2127a Mon Sep 17 00:00:00 2001 From: haramjeong <04harams77@gmail.com> Date: Mon, 7 Sep 2026 10:07:44 +0900 Subject: [PATCH] doc: clarify sub-1000ms behavior in socket.setKeepAlive The current documentation states that `initialDelay` and `interval` are divided by 1000 and rounded down, but does not explicitly mention that values less than 1000ms will result in 0 seconds. This can lead to confusion when users pass values like 400ms expecting sub-second keepalive delays. Add a concrete example showing that 400ms rounds down to 0 seconds. Refs: https://github.com/nodejs/node/issues/57712 Signed-off-by: haramjeong <04harams77@gmail.com> --- doc/api/net.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/net.md b/doc/api/net.md index d0b0e34c6504..91fd837cd49b 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -1669,7 +1669,9 @@ corresponding system default unchanged. `initialDelay` and `interval` are specified in milliseconds but the underlying socket options are configured in whole seconds; the values are -divided by `1000` and rounded down before being applied. +divided by `1000` and rounded down before being applied. For example, +setting `initialDelay` to `400` will result in a `TCP_KEEPIDLE` of `0` +seconds (since `400 / 1000` rounds down to `0`). Enabling the keep-alive functionality will set the following socket options: