summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Nagy <ronagy@icloud.com>2020-04-13 13:41:29 +0200
committerRobert Nagy <ronagy@icloud.com>2020-04-15 14:40:42 +0200
commit953445873a58513e673f6f05885406394ba66c79 (patch)
tree94855f295ccab358d1ec51b762da85e2013538fe
parenta495a5ea4ac740f33bf716b2fb8f1fe8ba8f4bad (diff)
downloadnode-new-953445873a58513e673f6f05885406394ba66c79.tar.gz
doc: improve net docs
Refer back to streams docs for further and more accurate description of behavior details. Refs: https://github.com/nodejs/node/issues/31916 PR-URL: https://github.com/nodejs/node/pull/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>
-rw-r--r--doc/api/net.md21
1 files changed, 12 insertions, 9 deletions
diff --git a/doc/api/net.md b/doc/api/net.md
index a9d84e0b17..aa2b918ecd 100644
--- a/doc/api/net.md
+++ b/doc/api/net.md
@@ -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.
+Destroys the stream and closes the connection.
-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.
### `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.
+
### `socket.end([data[, encoding]][, callback])`
<!-- YAML
added: v0.1.90
@@ -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.
### `socket.localAddress`
<!-- YAML
@@ -1261,13 +1261,16 @@ Returns `true` if input is a version 6 IP address, otherwise returns `false`.
[`socket.connect(path)`]: #net_socket_connect_path_connectlistener
[`socket.connect(port)`]: #net_socket_connect_port_host_connectlistener
[`socket.connecting`]: #net_socket_connecting
-[`socket.destroy()`]: #net_socket_destroy_exception
+[`socket.destroy()`]: #net_socket_destroy_error
[`socket.end()`]: #net_socket_end_data_encoding_callback
[`socket.pause()`]: #net_socket_pause
[`socket.resume()`]: #net_socket_resume
[`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