@@ -185,24 +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, string, or an array of either. Message to be
190
+ * ` msg ` Buffer object, string, or an array of either. Message to be
191
191
sent.
192
- * ` offset ` Integer. Offset in the buffer where the message starts.
193
- * ` length ` Integer. Number of bytes in the message.
192
+ * ` offset ` Integer. Optional. Offset in the buffer where the message starts.
193
+ * ` length ` Integer. Optional. Number of bytes in the message.
194
194
* ` port ` Integer. Destination port.
195
195
* ` address ` String. Destination hostname or IP address.
196
196
* ` callback ` Function. Called when the message has been sent. Optional.
197
197
198
198
Broadcasts a datagram on the socket. The destination ` port ` and ` address ` must
199
199
be specified.
200
200
201
- The ` buf ` argument is a [ ` Buffer ` ] object containing the message. The ` offset `
202
- and ` length ` specify the offset within the ` Buffer ` where the message begins
203
- 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
204
207
contain multi-byte characters, ` offset ` and ` length ` will be calculated with
205
208
respect to [ byte length] [ ] and not the character position.
209
+ If ` msg ` is an array, ` offset ` and ` length ` must not be specified.
206
210
207
211
The ` address ` argument is a string. If the value of ` address ` is a host name,
208
212
DNS will be used to resolve the address of the host. If the ` address ` is not
0 commit comments