You may have heard the term "packet" when talking about networks. But what exactly is a packet and how are they used within a network? Instead of diving straight into theory and practical examples, let's take a step back and think about what it is we are trying to achieve in simplistic terms. Networking is about communication, sharing information, sending and receiving messages and data. If we had to start over from scratch and send information over a wire, how might we do that? Let's say we wanted to send a simple "Hello world" message to one of our friends. We might set up a simple circuit that has a switch on one end and a light bulb or buzzer on the other. Then we could use that system to send morse code messages by flashing the light on and off for variable lengths of time to represent the dashes and dots.
If we expanded our circuit, we could send and receive by adding another switch and light bulb and further still by adding more circuits to allow more users. This is exactly what we are doing with networking, except we have added layers upon layers of sophisticated technology in order to send and receive more and more complex messages to more and more users with concepts such as addressing, switching, bridging, routing, and encryption to name but a few. It has become exponentially complex as we have scaled this communication globally, in particular because of the internet, but underneath it all is the same basic concept.
In most networks, "packets" are the unit of communication and transmission. Packets are logical structures that are passed between two or more points of communication that have a specific layout that enables them to be interpreted upon receipt. To be able to identify what that structure should look like and what the layout should be, packets of a certain type have a "protocol" such as IP protocol for IP communications. This defines what the packet should look like and how each participant in the network should expect to send and receive them. In radio communcations, you may have heard people using keywords like "roger", "over" and "over and out". These are predefined signals that have specific meaning. Similarly, a given protocol will have its own processes, keywords and packet structure that define how data is passed and interpreted.
A lot of network communication is about "encapsulation". To explain this concept, it can help to think of sending a letter in the post. In order to send a letter, you would compose the text you wished to send, place it in an envelope and onto that write the intended recipient and their address. Often you will also write the return address (your address) in case it cannot be delivered. This is a predefined protocol that you must follow in order to send some information via the postal system. In simplistic terms, you can think of a packet in the same way. The "header" of the packet can be thought of like the envelope and the "payload" like the letter. The header contains information such as source address (your address), destination address (recipients address) and size amongst other information and the payload is the actual data you wish to send. Once you have created a packet, it now needs to be transmitted to the recipient.
In order to send the packet, it must be converted from the data you created into a series of bits (0's and 1's). As we discussed before, to send data over a wire, it must first be converted into something that can be transmitted over that medium and binary is how we do this. Each section of the header is composed of a specific number of bits conforming to a specification and therefore can be interpreted when the packet is received on the other side. For example, treat the first 256 bits as header and the rest as payload. If you could see this, it would look like a long binary number. This again is analogous to morse code, but instead of dashes and dots, you have 0s and 1s. If you went even further looking at the physical level, you would see this as electrical signals with different voltages (in network cards or copper cabling for example) or light pulses (in fibre optic) depending on the medium.
Click here for the next part of the series: IP Addressing