Skip to content

dgram socket.send() documentation needs clarification #5124

@Trott

Description

@Trott

In the version of the dgram doc that is current as of this writing, the first argument (buf) is described initially as:

Buffer object, string, or an array of either. Message to be sent.

However, it is subsequently described as a Buffer object only:

The buf argument is a [Buffer] object containing the message. The offset
and length specify the offset within the Buffer where the message begins
and the number of bytes in the message, respectively. With messages that
contain multi-byte characters, offset and length will be calculated with
respect to [byte length][] and not the character position.

Additionally, it is not clear what offset and length mean when the buf argument is an array. It's also not clear if the multi-byte caveat applies if buf is a string or only if buf is a Buffer object.

It may be worth changing the name from buf to msg or something like that.

/cc @nodejs/documentation

Metadata

Metadata

Assignees

Labels

dgramIssues and PRs related to the dgram subsystem / UDP.docIssues and PRs related to the documentations.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions