@@ -185,23 +185,28 @@ never have reason to call this.
185185If ` multicastInterface ` is not specified, the operating system will attempt to
186186drop membership on all valid interfaces.
187187
188- ### socket.send(buf, offset, length, port, address[ , callback] )
188+ ### socket.send(msg, [ offset, length,] port, address[ , callback] )
189189
190- * ` buf ` Buffer object or string. Message to be sent
191- * ` offset ` Integer. Offset in the buffer where the message starts.
192- * ` length ` Integer. Number of bytes in the message.
190+ * ` msg ` Buffer object, string, or an array of either. Message to be
191+ sent.
192+ * ` offset ` Integer. Optional. Offset in the buffer where the message starts.
193+ * ` length ` Integer. Optional. Number of bytes in the message.
193194* ` port ` Integer. Destination port.
194195* ` address ` String. Destination hostname or IP address.
195196* ` callback ` Function. Called when the message has been sent. Optional.
196197
197198Broadcasts a datagram on the socket. The destination ` port ` and ` address ` must
198199be specified.
199200
200- The ` buf ` argument is a [ ` Buffer ` ] object containing the message. The ` offset `
201- and ` length ` specify the offset within the ` Buffer ` where the message begins
202- and the number of bytes in the message, respectively. With messages that
201+ The ` msg ` argument containins the message to be sent.
202+ Depending on its type, different behavior can apply. If ` msg ` is a ` Buffer ` ,
203+ the ` offset ` and ` length ` specify the offset within the ` Buffer ` where the
204+ message begins and the number of bytes in the message, respectively.
205+ If ` msg ` is a ` String ` , then it is automatically converted to a ` Buffer `
206+ with ` 'utf8' ` enecoding. With messages that
203207contain multi-byte characters, ` offset ` and ` length ` will be calculated with
204208respect to [ byte length] [ ] and not the character position.
209+ If ` msg ` is an array, ` offset ` and ` length ` must not be specified.
205210
206211The ` address ` argument is a string. If the value of ` address ` is a host name,
207212DNS will be used to resolve the address of the host. If the ` address ` is not
0 commit comments