Skip to content

Commit d3418b1

Browse files
aqrlnjoyeecheung
authored andcommitted
doc: fix stylistic issues in api/net.md
* Change var to const in an example of server creation. * Add missing semicolons. * Use `console` syntax highlighting in `telnet` and `nc` invocation examples and add shell prompt symbols to be consistent with the rest of the documentation. PR-URL: #11786 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 6ff495b commit d3418b1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

doc/api/net.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ double-backslashes, such as:
4040

4141
```js
4242
net.createServer().listen(
43-
path.join('\\\\?\\pipe', process.cwd(), 'myctl'))
43+
path.join('\\\\?\\pipe', process.cwd(), 'myctl'));
4444
```
4545

4646
## Class: net.Server
@@ -107,7 +107,7 @@ Returns an object with `port`, `family`, and `address` properties:
107107
Example:
108108

109109
```js
110-
var server = net.createServer((socket) => {
110+
const server = net.createServer((socket) => {
111111
socket.end('goodbye\n');
112112
}).on('error', (err) => {
113113
// handle errors here
@@ -758,7 +758,7 @@ socket.setTimeout(3000);
758758
socket.on('timeout', () => {
759759
console.log('socket timeout');
760760
socket.end();
761-
})
761+
});
762762
```
763763

764764
If `timeout` is 0, then the existing idle timeout is disabled.
@@ -997,8 +997,8 @@ server.listen(8124, () => {
997997

998998
Test this by using `telnet`:
999999

1000-
```sh
1001-
telnet localhost 8124
1000+
```console
1001+
$ telnet localhost 8124
10021002
```
10031003

10041004
To listen on the socket `/tmp/echo.sock` the third line from the last would
@@ -1012,8 +1012,8 @@ server.listen('/tmp/echo.sock', () => {
10121012

10131013
Use `nc` to connect to a UNIX domain socket server:
10141014

1015-
```js
1016-
nc -U /tmp/echo.sock
1015+
```console
1016+
$ nc -U /tmp/echo.sock
10171017
```
10181018

10191019
## net.isIP(input)

0 commit comments

Comments
 (0)