From 2662b0c9e33c95c0222a52a7f41ffe40f1896f41 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Mon, 13 Apr 2020 13:41:29 +0200 Subject: [PATCH] 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 Reviewed-By: Matteo Collina Reviewed-By: Luigi Pinca Reviewed-By: Denys Otrishko --- doc/api/net.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/api/net.md b/doc/api/net.md index a9d84e0b174882..aa2b918ecdac12 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])` -* `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])`