Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: improve net docs #32811

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
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
19 changes: 11 additions & 8 deletions doc/api/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -722,25 +722,26 @@ that the
[`socket.connect(options[, connectListener])`][`socket.connect(options)`]
callback is a listener for the `'connect'` event.

### `socket.destroy([exception])`
### `socket.destroy([error])`
<!-- YAML
added: v0.1.90
-->

* `exception` {Object}
* `error` {Object}
* Returns: {net.Socket}

Ensures that no more I/O activity happens on this socket. Only necessary in
case of errors (parse error or so).
Ensures that no more I/O activity happens on this socket. Effectivly discards
ronag marked this conversation as resolved.
Show resolved Hide resolved
any buffered data and ends the socket.
ronag marked this conversation as resolved.
Show resolved Hide resolved

If `exception` is specified, an [`'error'`][] event will be emitted and any
listeners for that event will receive `exception` as an argument.
See, [`writable.destroy()`][] for further details.
ronag marked this conversation as resolved.
Show resolved Hide resolved

### `socket.destroyed`

* {boolean} Indicates if the connection is destroyed or not. Once a
connection is destroyed no further data can be transferred using it.

See, [`writable.destroyed`][] for further details.
ronag marked this conversation as resolved.
Show resolved Hide resolved

### `socket.end([data[, encoding]][, callback])`
<!-- YAML
added: v0.1.90
Expand All @@ -754,8 +755,7 @@ added: v0.1.90
Half-closes the socket. i.e., it sends a FIN packet. It is possible the
server will still send some data.

If `data` is specified, it is equivalent to calling
`socket.write(data, encoding)` followed by [`socket.end()`][].
See, [`writable.end()`][] for further details.
ronag marked this conversation as resolved.
Show resolved Hide resolved

### `socket.localAddress`
<!-- YAML
Expand Down Expand Up @@ -1268,6 +1268,9 @@ Returns `true` if input is a version 6 IP address, otherwise returns `false`.
[`socket.setEncoding()`]: #net_socket_setencoding_encoding
[`socket.setTimeout()`]: #net_socket_settimeout_timeout_callback
[`socket.setTimeout(timeout)`]: #net_socket_settimeout_timeout_callback
[`writable.destroyed`]: stream.html#stream_writable_destroyed
[`writable.destroy()`]: stream.html#stream_writable_destroy_error
[`writable.end()`]: stream.html#stream_writable_end_chunk_encoding_callback
[half-closed]: https://tools.ietf.org/html/rfc1122
[stream_writable_write]: stream.html#stream_writable_write_chunk_encoding_callback
[unspecified IPv4 address]: https://en.wikipedia.org/wiki/0.0.0.0
Expand Down