Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
10ba94f
Refactor self=this
benjamingr Jan 24, 2016
60e4ad3
Update self=this in http.js
benjamingr Jan 24, 2016
1ebb5b2
Refactor self=this to arrows
benjamingr Jan 24, 2016
dd96a00
fix leading whitespace linter issue
benjamingr Jan 24, 2016
889f467
fix emberrasing mistake
benjamingr Jan 25, 2016
5f8b49d
doc: undo move http.IncomingMessage.statusMessage
techjeffharris Jan 22, 2016
e82760f
doc: check for errors in 'listen' event
benjamingr Jan 24, 2016
efc4f01
vm: introduce `cachedData`/`produceCachedData`
indutny Jan 21, 2016
0e16694
test: mark test-tick-processor flaky
Trott Jan 21, 2016
29775ae
stream: refactor redeclared variables
Trott Jan 22, 2016
1164bcb
doc: fix code type of markdowns
JacksonTian Jan 25, 2016
d3ce9d3
doc: add `servername` parameter docs
estliberitas Jan 17, 2016
085c5a0
dns: throw a TypeError in lookupService with invalid port
evanlucas Jan 24, 2016
38aa39d
test: refactor test-net-settimeout
Trott Jan 21, 2016
516d5da
test: fs.link() test runs on same device
drewfish Jan 25, 2016
935768b
tools: enable assorted ESLint error rules
silverwind Jan 25, 2016
a6f50c6
test: fix irregular whitespace issue
silverwind Jan 25, 2016
db19416
src: attach error to stack on displayErrors
cjihrig Jan 26, 2016
25c4f98
tools: add support for subkeys in release tools
MylesBorins Jan 21, 2016
1348386
doc: fix nonsensical grammar in Buffer::write
Jimbly Jan 25, 2016
69176e1
doc: keep the names in sorted order
thefourtheye Jan 26, 2016
4b876bf
doc: remove unnecessary bind(this)
wKich Jan 21, 2016
5d8a742
tls: scope loop vars with let
Trott Jan 25, 2016
e99a50d
test: scope redeclared variable
Trott Jan 14, 2016
ae09fc2
doc: document deprecation of util._extend
benjamingr Jan 27, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
doc: check for errors in 'listen' event
In the docs we typically check for errors and surface them. This
is IMO a good idea and good practice. This PR adds a check for
errors in three places in the `net` docs where it was missing.

PR-URL: #4834
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Roman Klauke <[email protected]>>
  • Loading branch information
benjamingr committed Jan 27, 2016
commit e82760f7d31ad97a1410def391543dc772665e7f
22 changes: 15 additions & 7 deletions doc/api/net.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ var server = net.createServer((socket) => {
});

// grab a random port.
server.listen(() => {
server.listen((err) => {
if (err) throw err;
address = server.address();
console.log('opened server on %j', address);
});
Expand Down Expand Up @@ -528,7 +529,8 @@ Here is an example of a client of the previously described echo server:

```js
const net = require('net');
const client = net.connect({port: 8124}, () => { //'connect' listener
const client = net.connect({port: 8124}, () => {
// 'connect' listener
console.log('connected to server!');
client.write('world!\r\n');
});
Expand Down Expand Up @@ -581,8 +583,8 @@ Here is an example of a client of the previously described echo server:

```js
const net = require('net');
const client = net.connect({port: 8124},
() => { //'connect' listener
const client = net.connect({port: 8124}, () => {
//'connect' listener
console.log('connected to server!');
client.write('world!\r\n');
});
Expand Down Expand Up @@ -649,15 +651,18 @@ on port 8124:

```js
const net = require('net');
const server = net.createServer((c) => { //'connection' listener
const server = net.createServer((c) => {
// 'connection' listener
console.log('client connected');
c.on('end', () => {
console.log('client disconnected');
});
c.write('hello\r\n');
c.pipe(c);
});
server.listen(8124, () => { //'listening' listener
server.listen(8124, (err) => {
// 'listening' listener
if (err) throw err;
console.log('server bound');
});
```
Expand All @@ -672,7 +677,10 @@ To listen on the socket `/tmp/echo.sock` the third line from the last would
just be changed to

```js
server.listen('/tmp/echo.sock', () => { /* 'listening' listener*/ })
server.listen('/tmp/echo.sock', (err) => {
// 'listening' listener
if (err) throw err;
});
```

Use `nc` to connect to a UNIX domain socket server:
Expand Down