Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Framed transport

FramedTransport is a generic transport wrapper for AsyncRead + AsyncWrite streams that uses a framing codec to divide a continuous byte stream into discrete messages.

This transport requires a codec implementing dnet::io::framed::Framing.

What it does

  • Wraps a lower-level transport that implements AsyncRead and AsyncWrite.
  • Encodes outgoing messages into frames using the provided codec.
  • Reads incoming bytes into an internal buffer and decodes complete frames as they arrive.

Constructors

When to use it

Notes

  • A framing codec can implement custom delimiting strategies beyond length-prefix framing.
  • The codec must preserve partial input until a full frame can be decoded.
  • FramedTransport::buffered is often a good default for network streams.