Skip to content

cf_server_send_msg

Category: net
GitHub: cute_networking.h


Queues a message to one client on a channel.

CF_Result cf_server_send_msg(CF_Server* server, int client_index, int channel, uint32_t id, const void* data, int size);
Parameters Description
server The server.
client_index An index representing a particular client, from CF_ServerEvent.
channel Which channel carries it, from 0 to CF_NET_MAX_CHANNELS - 1.
id A user-defined type tag delivered along with the bytes.
data The message bytes. May be NULL when size is 0.
size Size of data in bytes, up to CF_NET_MAX_MSG_SIZE.

Return Value

Returns an error if the message is oversized, the client is not connected, or that client's channel queue is full (queues drain each cf_server_update).

Remarks

The bytes are copied; data may be reused immediately. The client receives them with cf_client_pop_msg.

cf_server_pop_msg
cf_server_channel_options
cf_server_set_send_rate
cf_client_pop_msg