From df5d41bf93a304af4159398d0d9f44f0cba4ac94 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Wed, 11 Apr 2018 21:07:14 +0300 Subject: doc: add and unify even more return values PR-URL: https://github.com/nodejs/node/pull/19955 Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell --- doc/api/net.md | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'doc/api/net.md') diff --git a/doc/api/net.md b/doc/api/net.md index c3192c84c8..18da052bab 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -112,6 +112,8 @@ Emitted when the server has been bound after calling [`server.listen()`][]. added: v0.1.90 --> +* Returns: {Object} + Returns the bound address, the address family name, and port of the server as reported by the operating system if listening on an IP socket. Useful to find which port was assigned when getting an OS-assigned address. @@ -153,8 +155,6 @@ The optional `callback` will be called once the `'close'` event occurs. Unlike that event, it will be called with an Error as its only argument if the server was not open when it was closed. -Returns `server`. - ### server.connections +* Returns: {Object} + Returns the bound address, the address family name and port of the socket as reported by the operating system. Returns an object with three properties, e.g. @@ -601,8 +603,6 @@ For [IPC][] connections, available `options` are: See [Identifying paths for IPC connections][]. If provided, the TCP-specific options above are ignored. -Returns `socket`. - #### socket.connect(path[, connectListener]) * `path` {string} Path the client should connect to. See @@ -617,8 +617,6 @@ Alias to [`socket.connect(options[, connectListener])`][`socket.connect(options)`] called with `{ path: path }` as `options`. -Returns `socket`. - #### socket.connect(port[, host][, connectListener]) +* Returns: {boolean} + Sends data on the socket. The second parameter specifies the encoding in the case of a string — it defaults to UTF8 encoding. @@ -1068,24 +1066,29 @@ $ nc -U /tmp/echo.sock added: v0.3.0 --> -Tests if input is an IP address. Returns 0 for invalid strings, -returns 4 for IP version 4 addresses, and returns 6 for IP version 6 addresses. +* Returns: {integer} +Tests if input is an IP address. Returns `0` for invalid strings, +returns `4` for IP version 4 addresses, and returns `6` for IP version 6 +addresses. ## net.isIPv4(input) -Returns true if input is a version 4 IP address, otherwise returns false. +* Returns: {boolean} +Returns `true` if input is a version 4 IP address, otherwise returns `false`. ## net.isIPv6(input) -Returns true if input is a version 6 IP address, otherwise returns false. +* Returns: {boolean} + +Returns `true` if input is a version 6 IP address, otherwise returns `false`. [`'close'`]: #net_event_close [`'connect'`]: #net_event_connect -- cgit v1.2.3