From 24d420a8eaeccdf668768212015d36e921e58359 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Mon, 13 Apr 2020 13:41:29 +0200 Subject: [PATCH 1/7] 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 --- doc/api/net.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/api/net.md b/doc/api/net.md index a9d84e0b174882..4d1f80b3bab9e9 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. Effectivly discards +any buffered data and ends the socket. -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])`