oa::network::TcpFramed

Four-byte little-endian payload length followed by exact payload bytes. A framing error closes the stream, because a partial or rejected frame leaves no trustworthy next message boundary. Protocol semantics belong to the consuming session.

StRust public API

Declaration

pub struct TcpFramed;
Public Rust declaration.

Associated Functions

pub fn write_message(stream: &mut TcpStream, payload: &[u8]) -> Result<()>
pub fn read_message( stream: &mut TcpStream, max_payload_bytes: usize, ) -> Result<Vec<u8>>
pub fn read_message_into( stream: &mut TcpStream, payload: &mut Vec<u8>, max_payload_bytes: usize, ) -> Result<()>

Public Method Documentation

pub fn write_message(stream: &mut TcpStream, payload: &[u8]) -> Result<()>
No public source comment is attached to this declaration.
pub fn read_message( stream: &mut TcpStream, max_payload_bytes: usize ) -> Result<Vec<u8>>
No public source comment is attached to this declaration.
pub fn read_message_into( stream: &mut TcpStream, payload: &mut Vec<u8>, max_payload_bytes: usize, ) -> Result<()>
No public source comment is attached to this declaration.