doc: various improvements to net.md#11636
Conversation
doc/api/net.md
Outdated
There was a problem hiding this comment.
I think it also underlies UDP? or does that reimplement sockets?
There was a problem hiding this comment.
UDP is different code, no support for it in net
There was a problem hiding this comment.
:S just got enlightened by @addaleax , the stuff in this module is stream-based, UDP(dgram) is not.
addaleax
left a comment
There was a problem hiding this comment.
Just skimmed over it but looks pretty good in general (and helpful!) :)
doc/api/net.md
Outdated
There was a problem hiding this comment.
Maybe mention that this flag is explained in socket(7)?
There was a problem hiding this comment.
I trried http://man7.org/linux/man-pages/man7/socket.7.html but couldn't find an ID in that page(and it's a really long page)...maybe just add it because it's better than nothing? :3
There was a problem hiding this comment.
@joyeecheung Yeah, it’s better than nothing. I would even be okay with telling people to Ctrl+F it. 😄
doc/api/net.md
Outdated
There was a problem hiding this comment.
nit: Maybe use arbitrary unused port instead of random port? There doesn’t need to be any true randomness in the port choice
348944d to
186a790
Compare
doc/api/net.md
Outdated
sam-github
left a comment
There was a problem hiding this comment.
you are almost sorted in the markdown links at the bottom of page, but otherwise, LGTM
doc/api/net.md
Outdated
There was a problem hiding this comment.
this one is out of sort order now
doc/api/net.md
Outdated
doc/api/net.md
Outdated
There was a problem hiding this comment.
Hmm… both ends of a connection are net.Sockets, so maybe servers (…) and connections (…) is a bit better?
There was a problem hiding this comment.
Most of the examples for net.Socket call the returned value client though...? I guess saying it provides clients would help people looking for one.
There was a problem hiding this comment.
The argument for the 'connection' listener is a net.Socket, that’s where the non-client sockets come from.
I guess saying it provides clients would help people looking for one.
Not disagreeing! It’s definitely good to state that net provides servers and clients… I’m just trying to say that I would prefer to avoid any confusion of associating net.Socket with client.
If you think this is a non-issue, feel free to ignore this :)
There was a problem hiding this comment.
Perhaps
..and clients ([`net.Socket`][] calling [`connect()`][])
?
There was a problem hiding this comment.
@joyeecheung In that case we could just refer to createConnection 😄
But, yeah, this is getting really bike-shed-y and I trust your judgement on this :)
There was a problem hiding this comment.
I'll just put net.createServer and net.createConnection then (the classes are not usually newed anyway :D)
On a side note, what is the preferred way to create a client? net.createConnection and net.connect are just aliases now..(net.createConnection does look better when you put it alongside net.createServer though)
doc/api/net.md
Outdated
There was a problem hiding this comment.
nit: missing space before the opening parenthesis
doc/api/net.md
Outdated
There was a problem hiding this comment.
sends a FIN packet, thus ending the readable side of the socket.?
doc/api/net.md
Outdated
* Improve general description of the module, specifically, explain that it provides TCP or local communications (domain sockets on UNIX, named pipes on Windows) functionalities. * Improve explanation of `allowHalfOpen` * Nest the overloaded `server.listen()` API in a list, explain the common arguments and notes in the same place. Some minor improvements: * Add description to the `net.Server` constructor * Add type annotations to `server.listen()` * Add contexts to method links
434b6ac to
fb61a63
Compare
|
Addressed comments and rebased since #11167 is merged. |
|
CI before landing: https://ci.nodejs.org/job/node-test-pull-request/6699/ |
|
osx build failure is unrelated, tried another one and it build scucessfully.. https://ci.nodejs.org/job/node-test-commit-osx/8200/ Landed in 3b05153, thanks! |
* Improve general description of the module, specifically, explain that it provides TCP or local communications (domain sockets on UNIX, named pipes on Windows) functionalities. * Improve explanation of `allowHalfOpen` * Nest the overloaded `server.listen()` API in a list, explain the common arguments and notes in the same place. Some minor improvements: * Add description to the `net.Server` constructor * Add type annotations to `server.listen()` * Add contexts to method links PR-URL: #11636 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
|
This is not landing cleanly on v7.x-staging. Mind submitting a backport PR? |
|
Should this be backported to |
explain that it provides TCP or local communications
(domain sockets on UNIX, named pipes on Windows) functionalities.
allowHalfOpenserver.listen()API in a list, explainthe common arguments and notes in the same place.
Some minor improvements:
net.Serverconstructorserver.listen()TODO: do the same thing to
net.Socketif this one is good to go.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
net, doc