cf_client_send_msg¶
Category: net
GitHub: cute_networking.h
Queues a message to the server on a channel.
CF_Result cf_client_send_msg(CF_Client* client, int channel, uint32_t id, const void* data, int size);
| Parameters | Description |
|---|---|
client |
The client. |
channel |
Which channel carries it, from 0 to CF_NET_MAX_CHANNELS - 1. |
id |
A user-defined type tag delivered along with the bytes (e.g. an enum of your game's message kinds). |
data |
The message bytes. May be NULL when size is 0 -- an id alone is a fine message. |
size |
Size of data in bytes, up to CF_NET_MAX_MSG_SIZE. |
Return Value¶
Returns an error if the message is oversized or the channel's local queue is full (the queue drains each cf_client_update, paced by cf_client_set_send_rate).
Remarks¶
The bytes are copied; data may be reused immediately. Messages go over the wire during
cf_client_update, highest-priority channel first. The server receives them with
cf_server_pop_msg.
Related Pages¶
cf_client_pop_msg
cf_client_channel_options
cf_client_set_send_rate
cf_server_pop_msg