Messages, Streams, and Network Packets
An application message has a meaning under its own format. A transport stream or a packet can represent only part of that exchange.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace divided input
One application can send a five-byte record and a receiver can observe two bytes followed by three under a stream interface. The underlying packet layout need not match those reads. Review fixed-size reads.
Write an explicit framing rule
A receiver needs a delimiter with escaping, a length field, or another boundary convention. Delimiter and length framing compares two such policies.[1][2]
Trace application bytes through arbitrary read boundaries
An application sends the records A and BC over a byte stream. The receiving code might read ABC in one call or get A, then B, then C. A TCP stream's reliability and ordering do not preserve the sender's call boundaries. The application needs framing to recover records. See delimiter and length framing.
Logical records: A and BC
Stream bytes: ABC
Possible reads: AB, C
Without framing, ABC also fits the split AB and C
Name the unit at each network layer
Packets and application messages can differ in size and count. Choose a stream protocol's framing separately from transport details. Test coalesced records and one record split across reads.