docs: Updates dgram doc with optional port for socket.bind() #5686

Closed
wants to merge 2 commits into
from

Projects

None yet

3 participants

@dcousens

As explained several times throughout this document already:

socket.bind() will bind to the "all interfaces" address on a random port (it does the right thing for both udp4 and udp6 sockets).

and

If the socket has not been previously bound with a call to bind, it's assigned a random port number and bound to the "all interfaces" address (0.0.0.0 for udp4 sockets, ::0 for udp6 sockets).

I felt for an API lookup, it is a good idea to repeat this in socket.bind itself.

@Nodejs-Jenkins

Thank you for contributing this pull request! Here are a few pointers to make sure your submission will be considered for inclusion.

Commit RommelVR/node@a297796 has the following error(s):

  • First line of commit message must be no longer than 50 characters
  • Commit message must indicate the subsystem this commit changes
  • Commit message line too long: 5
  • Commit message line too long: 6
  • Commit message line too long: 7
  • Commit message line too long: 19

The following commiters were not found in the CLA:

  • Daniel Cousens

You can fix all these things without opening another issue.

Please see CONTRIBUTING.md for more information

@bnoordhuis bnoordhuis and 1 other commented on an outdated diff Jun 14, 2013
doc/api/dgram.markdown
* `address` String, Optional
* `callback` Function, Optional
For UDP sockets, listen for datagrams on a named `port` and optional `address`.
+If `port` is not specified, the OS will try to assign a random port (it does the right thing for
@bnoordhuis
bnoordhuis Jun 14, 2013 Node.js Foundation member

Long line, please wrap at 80 columns.

@bnoordhuis
bnoordhuis Jun 14, 2013 Node.js Foundation member

Also, the "does the right thing" comment elsewhere applies to the address, not the port.

@dcousens
dcousens Jul 2, 2013

Is what exists now suitable? (See latest commit)

@dcousens dcousens closed this May 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment