ReferenceRakNet

raknet.send

Sends packet bytes through the current supported game connection.

Syntax

raknet.send(data: string | buffer | {number}, priority: number?, reliability: number?, channel: number?) -> ()

Parameters

ParameterTypeDescription
datastring, buffer or byte arrayComplete valid protocol message.
prioritynumber?Priority 0–3; default 2.
reliabilitynumber?Reliability mode 0–7; default 3.
channelnumber?Ordering channel 0–31; default 0.

Description

Data must be nonempty. Byte-array entries must be integers from 0 through 255. Priority is 0–3, reliability is 0–7 and channel is 0–31; defaults are 2, 3 and 0. Registered outgoing hooks also see this send. An unavailable connection, invalid range or unsupported session raises an error.

This is a low-level transport API, not a RemoteEvent substitute. Arbitrary bytes are not a valid game message. Use only a protocol and receiver you own or are authorized to test.

Example

local function sendValidatedPacket(bytes)
    assert(type(bytes) == "string" and #bytes > 0)
    raknet.send(bytes, 2, 3, 0)
end

Notes

These are Game executor contracts. Check build requirements and session lifetimes before using them.