From 9af5ce25ba39a368da0555629a0f073b4cbbd6a4 Mon Sep 17 00:00:00 2001 From: Alexey Orlenko Date: Fri, 10 Mar 2017 12:07:15 +0200 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/11786 Reviewed-By: Luigi Pinca Reviewed-By: Joyee Cheung Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- doc/api/net.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/api/net.md b/doc/api/net.md index d20e6bf767e047..f1df6911859d32 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -40,7 +40,7 @@ double-backslashes, such as: ```js net.createServer().listen( - path.join('\\\\?\\pipe', process.cwd(), 'myctl')) + path.join('\\\\?\\pipe', process.cwd(), 'myctl')); ``` ## Class: net.Server @@ -107,7 +107,7 @@ Returns an object with `port`, `family`, and `address` properties: Example: ```js -var server = net.createServer((socket) => { +const server = net.createServer((socket) => { socket.end('goodbye\n'); }).on('error', (err) => { // handle errors here @@ -758,7 +758,7 @@ socket.setTimeout(3000); socket.on('timeout', () => { console.log('socket timeout'); socket.end(); -}) +}); ``` If `timeout` is 0, then the existing idle timeout is disabled. @@ -997,8 +997,8 @@ server.listen(8124, () => { Test this by using `telnet`: -```sh -telnet localhost 8124 +```console +$ telnet localhost 8124 ``` To listen on the socket `/tmp/echo.sock` the third line from the last would @@ -1012,8 +1012,8 @@ server.listen('/tmp/echo.sock', () => { Use `nc` to connect to a UNIX domain socket server: -```js -nc -U /tmp/echo.sock +```console +$ nc -U /tmp/echo.sock ``` ## net.isIP(input)