[HN Gopher] Consistent Overhead Byte Stuffing (1999) [pdf]
___________________________________________________________________
Consistent Overhead Byte Stuffing (1999) [pdf]
Author : tjalfi
Score : 31 points
Date : 2021-04-03 21:44 UTC (1 days ago)
(HTM) web link (www.stuartcheshire.org)
(TXT) w3m dump (www.stuartcheshire.org)
| layoutIfNeeded wrote:
| So how would you send a single non-zero byte this way? Or is that
| why you need the zero byte to delimit your messages? Also it
| seems that if you wanted to pause your transmission you can't
| really "flush" the incomplete COBS frame unless it happens to end
| with a zero...
| lifthrasiir wrote:
| > COBS first takes its input data and logically appends a
| single zero byte. (It is not necessary actually to add this
| zero byte to the end of the packet in memory; the encoding
| routine simply has to behave as if the added zero were there.)
|
| So it's `02 xx`. By the way, a single zero byte would be `01
| 01`.
| layoutIfNeeded wrote:
| Ah, thanks, I've missed that part.
| jevinskie wrote:
| https://github.com/cmcqueen/cobs-python/blob/68cebe6b49dfa19...
| superjan wrote:
| For an example closer to home, the JPEG family of image
| compression formats all have a byte stuffing algorithm to avoid
| JPEG markers from occurring in the compressed stream.
| userbinator wrote:
| USB and video codecs also come to mind.
| w0mbat wrote:
| This is Stuart's PhD paper from Stanford. His later work includes
| ZeroConf, Rendezvous/Bonjour, and a lot of the underlying network
| code of modern Apple devices. Some people may know him from his
| legendary multiplayer tank combat game, Bolo for BBC Micro and
| vintage Mac.
| cozzyd wrote:
| COBS is also nice over serial because the most likely corruption
| that can happen is a dropped byte, which COBS can usually detect.
| chrisdalke wrote:
| One nice use case of COBS is to clearly delimit packets being
| sent over a serial stream. Framing packets with zero bytes is
| particularly convenient for small projects because it's easy to
| implement and debug.
|
| I've used COBS and MessagePack combined for some embedded sensor
| projects. My implementation for Arduino (also includes some other
| functionality on top to encode data with MessagePack):
| https://github.com/telemetryjet/telemetryjet-arduino-sdk
___________________________________________________________________
(page generated 2021-04-04 23:01 UTC)