Skip to main content

Module tcp

Module tcp 

Source
Expand description

TCP transport implementation with length-prefixed framing.

Uses a simple 4-byte big-endian length header followed by the payload. Maximum payload size is 64 MB to prevent accidental memory exhaustion.

Structs§

TcpConnection
A persistent TCP connection with length-prefixed framing.
TcpTransport
TCP-based transport using length-prefixed framing.

Constants§

MAX_PAYLOAD_SIZE
Maximum payload size: 64 MB.

Functions§

read_length_prefixed
Read a length-prefixed frame: read raw bytes, then decompress.
write_length_prefixed
Write a length-prefixed frame: compress, then write 4-byte BE length + framed payload.