Detecting an Incomplete Encoded Frame
Before interpreting a payload, a reader can check whether its expected length and any required trailer are present.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace a short received record
A header announces four payload bytes but only three follow before the stream ends. No complete frame is available under that format. See length-prefixed records.
Check a distinct integrity failure
A complete record can still fail its error check. Report the two cases separately if they have different recovery options. End of file states supply the incomplete-input distinction.[1][2]
Verify framing before interpreting integrity data
A toy frame announces five payload bytes and a trailing check byte. A source closing after only three payload bytes leaves the frame incomplete. Applying a check to those three bytes cannot establish validity of the missing frame. See partial receives.
Header declares length 5
Only payload bytes A,B,C received
Expected two more payload bytes and one check byte
End here → incomplete frame
Separate temporary fragmentation from terminal truncation
A read can return only part of a frame while more bytes are pending. Wait according to the API until completion or a defined stop. Verify length bounds before accumulating the declared payload.