Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.oxd.sh/llms.txt

Use this file to discover all available pages before exploring further.

ox_accel_send

Send a payload through the accelerated tunnel.
OxAccelError ox_accel_send(OxAccel *ctx, const uint8_t *data, size_t len)

Parameters

ctx
OxAccel*
required
Connected context.
data
const uint8_t*
required
Pointer to payload bytes. Must point to at least len readable bytes.
len
size_t
required
Payload length in bytes. Must be greater than 0.

Returns

ValueMeaning
OkData sent successfully
InvalidParamNULL pointer or zero length
NotConnectedox_accel_connect not called
SendFailedNetwork error

Example

uint8_t gamestate[] = { /* serialized game state */ };
OxAccelError err = ox_accel_send(ctx, gamestate, sizeof(gamestate));
if (err == OxAccelError_SendFailed) {
    // Handle network error — reconnect or queue
}
The SDK borrows data only for the duration of the call. You can reuse or free the buffer immediately after ox_accel_send returns.

ox_accel_recv

Receive a payload from the accelerated tunnel.
OxAccelError ox_accel_recv(
    OxAccel *ctx,
    uint8_t *buf,
    size_t   buf_len,
    size_t  *out_len
)

Parameters

ctx
OxAccel*
required
Connected context.
buf
uint8_t*
required
Caller-allocated receive buffer. Must point to at least buf_len writable bytes.
buf_len
size_t
required
Size of the receive buffer in bytes.
out_len
size_t*
required
On success, receives the number of bytes written to buf.

Returns

ValueMeaning
OkData received, *out_len set
InvalidParamNULL pointer or zero buffer
NotConnectedox_accel_connect not called
RecvFailedNetwork error
BufferTooSmallBuffer too small for incoming data

Example

uint8_t buf[65536];
size_t received = 0;

OxAccelError err = ox_accel_recv(ctx, buf, sizeof(buf), &received);
if (err == OxAccelError_Ok) {
    process_packet(buf, received);
}
For gaming and real-time use cases, use a 64 KB buffer (65536 bytes) — this covers the maximum UDP payload with room to spare.