Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

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

Closed
wants to merge 2 commits into from
Closed

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

wants to merge 2 commits into from

Conversation

dcousens
Copy link

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
Copy link

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@a2977963c40daa79b7a0e2e8675be9d8ce188e54 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

* `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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long line, please wrap at 80 columns.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is what exists now suitable? (See latest commit)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants