Skip to content

Commit 24d420a

Browse files
committed
doc: improve net docs
Refer back to streams docs for further and more accurate description of behavior details. Refs: #31916
1 parent aeb7084 commit 24d420a

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

doc/api/net.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -722,25 +722,26 @@ that the
722722
[`socket.connect(options[, connectListener])`][`socket.connect(options)`]
723723
callback is a listener for the `'connect'` event.
724724

725-
### `socket.destroy([exception])`
725+
### `socket.destroy([error])`
726726
<!-- YAML
727727
added: v0.1.90
728728
-->
729729

730-
* `exception` {Object}
730+
* `error` {Object}
731731
* Returns: {net.Socket}
732732

733-
Ensures that no more I/O activity happens on this socket. Only necessary in
734-
case of errors (parse error or so).
733+
Ensures that no more I/O activity happens on this socket. Effectivly discards
734+
any buffered data and ends the socket.
735735

736-
If `exception` is specified, an [`'error'`][] event will be emitted and any
737-
listeners for that event will receive `exception` as an argument.
736+
See, [`writable.destroy()`][] for further details.
738737

739738
### `socket.destroyed`
740739

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

743+
See, [`writable.destroyed`][] for further details.
744+
744745
### `socket.end([data[, encoding]][, callback])`
745746
<!-- YAML
746747
added: v0.1.90
@@ -754,8 +755,7 @@ added: v0.1.90
754755
Half-closes the socket. i.e., it sends a FIN packet. It is possible the
755756
server will still send some data.
756757

757-
If `data` is specified, it is equivalent to calling
758-
`socket.write(data, encoding)` followed by [`socket.end()`][].
758+
See, [`writable.end()`][] for further details.
759759

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

0 commit comments

Comments
 (0)