Skip to content

Commit

Permalink
doc: document that server.address() can return null
Browse files Browse the repository at this point in the history
PR-URL: #32519
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
watson authored and targos committed Apr 11, 2020
1 parent cede0cb commit 31b2cbb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doc/api/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Emitted when the server has been bound after calling [`server.listen()`][].
added: v0.1.90
-->

* Returns: {Object|string}
* Returns: {Object|string|null}

Returns the bound `address`, the address `family` name, and `port` of the server
as reported by the operating system if listening on an IP socket
Expand All @@ -138,7 +138,8 @@ server.listen(() => {
});
```

Don't call `server.address()` until the `'listening'` event has been emitted.
`server.address()` returns `null` before the `'listening'` event has been
emitted or after calling `server.close()`.

### `server.close([callback])`
<!-- YAML
Expand Down

0 comments on commit 31b2cbb

Please sign in to comment.