Skip to content

Commit 8f9f92f

Browse files
Trottcodebytere
authored andcommitted
doc,net: reword Unix domain path paragraph in net.md
Reword the paragraph on Unix domain paths. Hopefully, it is a little bit more clear and easier to read now. PR-URL: #31684 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 99cfab2 commit 8f9f92f

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

doc/api/net.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,16 @@ sockets on other operating systems.
2626
[`socket.connect()`][] take a `path` parameter to identify IPC endpoints.
2727

2828
On Unix, the local domain is also known as the Unix domain. The path is a
29-
filesystem pathname. It gets truncated to a length of
30-
`sizeof(sockaddr_un.sun_path) - 1`, which varies 91 and 107 bytes depending on
31-
the operating system. The typical values are 107 on Linux and 103 on macOS. The
32-
path is subject to the same naming conventions and permissions checks as would
33-
be done on file creation. If the Unix domain socket (that is visible as a file
34-
system path) is created and used in conjunction with one of Node.js' API
35-
abstractions such as [`net.createServer()`][], it will be unlinked as part of
36-
[`server.close()`][]. On the other hand, if it is created and used outside of
37-
these abstractions, the user will need to manually remove it. The same applies
38-
when the path was created by a Node.js API but the program crashes abruptly.
39-
In short, a Unix domain socket once successfully created will be visible in the
40-
filesystem, and will persist until unlinked.
29+
filesystem pathname. It gets truncated to an OS-dependent length of
30+
`sizeof(sockaddr_un.sun_path) - 1`. Typical values are 107 bytes on Linux and
31+
103 bytes on macOS. If a Node.js API abstraction creates the Unix domain socket,
32+
it will unlink the Unix domain socket as well. For example,
33+
[`net.createServer()`][] may create a Unix domain socket and
34+
[`server.close()`][] will unlink it. But if a user creates the Unix domain
35+
socket outside of these abstractions, the user will need to remove it. The same
36+
applies when a Node.js API creates a Unix domain socket but the program then
37+
crashes. In short, a Unix domain socket will be visible in the filesystem and
38+
will persist until unlinked.
4139

4240
On Windows, the local domain is implemented using a named pipe. The path *must*
4341
refer to an entry in `\\?\pipe\` or `\\.\pipe\`. Any characters are permitted,

0 commit comments

Comments
 (0)