Broadcast Method  

Broadcast data to all active clients connected to the server.


object.Broadcast( Buffer, [Length] )


A buffer variable that contains the data to be written to the server. If the variable is a String type, then the data will be written as a string of characters. This is the most appropriate data type to use if the server expects text data that consists of printable characters. If the server is expecting binary data, it is recommended that a Byte array be used instead.
A numeric value which specifies the number of bytes to write. Its maximum value is 231-1 = 2147483647. If a value is specified for this argument and it is greater than the actual size of the buffer, then the Length argument will be ignored and the entire contents of the buffer will be written. If the argument is omitted, then the maximum number of bytes to write is determined by the size of the buffer.

Return Value

This method returns the number of clients that the data was broadcast to. A return value of -1 indicates an error condition, and the value of the LastError property will indicate the cause of the failure.


The Broadcast method sends the data in Buffer to all clients connected to the server. If this method is called inside a server event handler, the message is broadcast to all clients except for the current, active client that is processing the event notification. If this method is called outside of an event handler, the data is broadcast to all connected clients.

See Also

Read Method, ReadLine Method, Write Method, WriteLine Method