Send
This function sends a message to a specific client.
Syntax
- bool Send(Peer* client, const int message, const std::string& text, const int channel=0, const int flags=0)
- bool Send(Peer* client, const int message, Bank* bank, const int channel=0, const int flags=0)
Parameters
- peer: this is the peer to send a message to, first identified when a Connected message is received.
- message: user-defined message ID. This must be greater than zero.
- data: a bank containing the user-defined data to send over the network.
- text: a string of text to send, for example a chat message.
- channel: the channel to send the message over, used for sequencing packets.
- flags: optional parameter for flags which can include the following:
- Message.Reliable: this message has extra checks to make sure it is received successfully.
- Message.Ordered: messages on this channel will arrive in the order they are sent.
Returns
Returns true if the message was successfully sent, otherwise false is returned.