network.send

Submits a packet to the current UDP session.

Syntax

Signature
network.send(Payload: Packet | table | string | buffer) -> (boolean, string?)

Aliases

  • raknet.send
  • packets.send
  • RakNet.send

Parameters

ParameterTypeDescription
PayloadPacket | table | string | bufferPayload accepted by network.encode.

Returns

TypeDescription
booleanWhether submission succeeded.
string?Failure message when the result is false.

Notes

It accepts the same payload forms as network.encode. Additional RakNet priority, reliability, and ordering arguments are not supported. Success reports transport submission and does not confirm that the server accepted or applied the packet.

Example

Luau
if not network.isavailable() then
    warn("Packet transport is unavailable")
    return
end

local Packet = network.create("Ping", {value = 12345})
local Success, Error = network.send(Packet)
if Success then
    print("Ping submitted to the transport")
else
    warn("Send failed:", Error)
end
-- Submission does not confirm that the server handled the packet.