Menu

Protocols & Layers

Protocols

A protocol is a set of rules that governs how devices communicate over a network. It is not a piece of hardware, and it is not a single program you install — it is an agreed set of rules that the software on each device follows when it sends or receives data.

Devices must all follow the same rules so that they can interpret the data they exchange correctly. Two devices built by completely different manufacturers can still swap data, because both sides have agreed in advance exactly how that data will look and what each part of it means.

What the rules cover

  • the format of the data — the layout of each message, so the receiver knows where one part ends and the next begins
  • the order and timing — which device sends first, how much it sends at once, and how long the other waits before replying
  • what to do when something goes wrong, such as a damaged message arriving or a message never arriving at all

A worked example

Imagine a tablet sending a 2 MB file of quiz scores to a laptop on the same network. Suppose the tablet sends everything in one long burst. The laptop has no shared rule for where one score ends and the next begins, so it splits the data in the wrong places and the scores are scrambled. Each device followed its own rules, but they were not the same rules.

Now give them a shared protocol. The tablet first sends a short header saying how many scores follow. It then sends them in fixed 1 KB pieces, and the laptop replies to each piece to confirm it arrived. If one piece is damaged, only that piece is sent again. The scores arrive intact and in the right order, because both devices were playing by the same rules.

Sequence diagram between a tablet and a laptop: a header, 1 KB pieces each answered by a reply, a damaged piece that is sent again, and a final reply.

Practise this