Menu

Packet Switching

Packet Structure

A packet is a small unit of data sent across a network. Packets share the same basic structure: a header at the front, then the data being sent, and sometimes a footer at the very end.

The parts of a packet

PartPositionPurpose
HeaderFirst, at the start of the packetHolds control information about the packet
DataAfter the header, in the middleThe actual content being sent
FooterLast, at the end (not always present)Marks the end of the packet and can carry extra information

The header sits at the very start because it carries control information — the details about the packet itself rather than the content you are sending. Putting this first means a network device can read it immediately, before it deals with the data behind it.

The data (also called the payload) is the part that actually matters to you: the slice of a photo, a line of a message, a piece of a file. It is never stored inside the header. It sits between the header and the footer, so in a packet with both, the data is sandwiched in the middle.

A footer is optional. Some packets finish straight after the data, while others have a footer at the end to show where the packet stops and to hold any extra information the receiver needs. Because it is optional, you cannot assume every packet has one.

A packet drawn left to right as a header with control information, the data (payload), and an optional footer, with what each holds in the online game example.

Worked example

You fire an arrow at another player in an online game. The game turns that single action into a packet before it leaves your device. The header goes first and carries the control information — which device sent it and which device should receive it. Next comes the data: the small piece of content saying that an arrow was fired and where it is heading. A footer may follow at the end, holding a value the receiver can check to make sure nothing was garbled on the way. The data never hides inside the header — it sits between the header and the footer, in the middle.

Practise this