@@ -185,23 +185,28 @@ never have reason to call this.
185
185
If ` multicastInterface ` is not specified, the operating system will attempt to
186
186
drop membership on all valid interfaces.
187
187
188
- ### socket.send(buf, offset, length, port, address[ , callback] )
188
+ ### socket.send(msg, [ offset, length,] port, address[ , callback] )
189
189
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.
193
194
* ` port ` Integer. Destination port.
194
195
* ` address ` String. Destination hostname or IP address.
195
196
* ` callback ` Function. Called when the message has been sent. Optional.
196
197
197
198
Broadcasts a datagram on the socket. The destination ` port ` and ` address ` must
198
199
be specified.
199
200
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
203
207
contain multi-byte characters, ` offset ` and ` length ` will be calculated with
204
208
respect to [ byte length] [ ] and not the character position.
209
+ If ` msg ` is an array, ` offset ` and ` length ` must not be specified.
205
210
206
211
The ` address ` argument is a string. If the value of ` address ` is a host name,
207
212
DNS will be used to resolve the address of the host. If the ` address ` is not
0 commit comments