Skip to content

Networking

Алексей . edited this page Oct 22, 2026 · 4 revisions

All client networking is reached through context.SF.Samp. Events supplies typed parsed messages; Packets and Rpc expose copied raw frames and synchronous filters; PacketParsers/RpcParsers provide explicit decoding; Network sends or emulates traffic. Native Actions are a separate client-routine observation API.

Capture boundary

The core hooks native SA-MP RakClient Send overloads, Receive, outgoing RPC and the incoming RPC dispatcher. Hooking only the outer interface proxy would miss packets consumed by a wrapper before it returns. RPC dispatch also needs its own hook because Receive can consume RPC containers internally.

These are logical RakNet messages, not a UDP capture. Transport ACKs/fragments and private networking used by other ASIs are outside that guarantee. You cannot observe another player's private outgoing request unless the server forwards it to this client. Unknown numeric IDs remain available even without enum names or parsers.

Ownership and filtering

Raw frames own managed copies of native bytes. Ordinary callbacks are delivered on the game thread. Synchronous filters execute on the hook thread, must stay fast/nonblocking and return true to drop a message. Dropped messages do not reach the normal asynchronous observers. Observation-source callbacks run on the provider's publishing thread instead.

Packet copies, queues and consumers still cost memory. Use a deliberate recorder design for sustained traffic; DebugWeb is a bounded inspector. Separate capture, history eviction, delivery and rendering when diagnosing apparent gaps.

Transport

SendPacket accepts the complete packet including its ID. SendRpc accepts a separate RPC ID, payload and valid bit length. SimulateIncomingPacket/SimulateIncomingRpc inject local synthetic input into the client pipeline; they do not produce a real server response. Transport calls require the game thread, and send success is not server acceptance.

See raw frames, typed events, timestamp envelopes, custom providers, ISFNetwork and native integration.

Clone this wiki locally