Bit stuffing – an article about network protocols
I am a strong advocate for not “reinventing the wheel”. Doing something from scratch, unless you really have a novel approach that will yield some improvement over what has been done before, is rarely sensible outside of an educational context.
But sometimes it can be useful to understand some of the underlying principles of something that you plan to utilize …
Networking is a specialist subject and I am not such a specialist. That is just one reason why I would advise any embedded developer to consider the purchase of an off the shelf networking stack, instead of an in-house implementation. Apart from the obvious productivity factors, compliance with standards is an enormous overhead; by definition, a networked device needs to talk with other devices and, hence, such compliance is necessary.
As I said, it is useful to understand something about how networking protocols function and I recently wrote an article that might be of interest to other developers who are not networking specialists:
There are a variety of different circumstances when an embedded system needs to deal with data that is presented as a stream of bits. This is not, in itself, a problem but bits only come in two flavors – 0 and 1. This makes it difficult to manage the flow of data, as there is no easy way to determine the end of a packet or message, for example. When data traffic was controlled by hardware, this was addressed using a “long 1” or “long 0”, but this is rarely an option with modern systems. So, network protocol designers have developed techniques that involve adding extra bits in appropriate ways. This is commonly called “bit stuffing”. This article takes a look at those techniques and how they work.