You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Activity
silverwind commentedon Feb 7, 2016
cc: @mcollina
eljefedelrodeodeljefe commentedon Feb 7, 2016
That is a very good idea, if this is working correctly.
mcollina commentedon Feb 7, 2016
Thanks @silverwind! And thanks for reviewing @Trott!
@eljefedelrodeodeljefe what do you refer to? #4374 should work as expected yes.
Just to clarify:
offsetandlenmeans nothing if an array is passed.Bufferwith'utf8'encoding. (this was never specified even in the original docs).yes, agreed.
I will send a PR to update the docs and resolve this.
eljefedelrodeodeljefe commentedon Feb 7, 2016
@mcollina nothing special. Just haven't tested passing non-Buffer primitives.
mcollina commentedon Feb 7, 2016
@eljefedelrodeodeljefe please do :).
mcollina commentedon Feb 7, 2016
PR sent #5130
doc: clarify dgram socket.send() multi-buffer support
doc: clarify dgram socket.send() multi-buffer support
doc: clarify dgram socket.send() multi-buffer support