Skip to content

Commit e9927e5

Browse files
ronagtargos
authored andcommitted
doc: improve net docs
Refer back to streams docs for further and more accurate description of behavior details. Refs: #31916 PR-URL: #32811 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
1 parent 6d6bb2a commit e9927e5

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

doc/api/net.md

+12-9
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.
734+
Destroys the stream and closes the connection.
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
@@ -1261,13 +1261,16 @@ Returns `true` if input is a version 6 IP address, otherwise returns `false`.
12611261
[`socket.connect(path)`]: #net_socket_connect_path_connectlistener
12621262
[`socket.connect(port)`]: #net_socket_connect_port_host_connectlistener
12631263
[`socket.connecting`]: #net_socket_connecting
1264-
[`socket.destroy()`]: #net_socket_destroy_exception
1264+
[`socket.destroy()`]: #net_socket_destroy_error
12651265
[`socket.end()`]: #net_socket_end_data_encoding_callback
12661266
[`socket.pause()`]: #net_socket_pause
12671267
[`socket.resume()`]: #net_socket_resume
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)