HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
Packets and Methods of Data Transmission
  1. 1Packets and packet switching
  2. 2Serial and parallel, simplex and duplex
  3. 3The universal serial bus (USB)
  1. Computer Science
  2. /Packets and Methods of Data Transmission
  3. /Packets and packet switching

Course 2.1·Lesson 1 of 3

Packets and packet switching

Data sent across a network is broken down into packets. This lesson shows the three parts of a packet and what the header holds. Then it shows how packet switching sends each packet by its own route and puts the packets back in order.

about 25 min1 simulation1 practice question
Lesson 1 of 3Show all lessonsHide
Packets and Methods of Data Transmission
  1. 1Packets and packet switching
  2. 2Serial and parallel, simplex and duplex
  3. 3The universal serial bus (USB)

Try the code and the simulations beside the lesson.

Why cut data into pieces?

Think of moving house with one giant box. It would block the stairs, and if it fell, everything inside would break. Many small boxes are easier. Each one can go in a different car, and if one is dropped, you only repack that one.

Networks work the same way. A photo, an email or a video is broken down into packets before it is sent. A packet is a small, fixed-size piece of the data with some extra information added to it. Each packet travels on its own. At the other end, the receiving device joins the packets back together.

The structure of a packet

Every packet has three parts.

A long bar split into three boxes from left to right. The first box is the packet header and lists the destination address, the packet number and the originator's address. The middle and widest box is the payload, the data being carried. The last box is the trailer, which marks the end of the packet.
  • Packet header. It comes first. It holds the information that gets the packet to the right place.
  • Payload. This is the actual data being carried: a piece of the photo, email or video.
  • Trailer. It comes last and marks the end of the packet. It often holds an error check, so the receiver can test whether the packet changed on the way. You meet error checks in the next course.

The header holds three things you must know.

  • The destination address: where the packet is going.
  • The packet number: its place in the whole message, so the packets can be put back in order.
  • The originator's address: where the packet came from, so a reply or a request to send again can find its way back.

Here is an example. A message is cut into 555 packets. Packet number 333 carries the third piece of the message. Its header says "to laptop B, packet 3, from phone A".

A common mistake is to say the header holds the data. It does not. The data is the payload.

Packet switching

On a large network there are many paths between two devices. The devices that choose the path are called routers. Packet switching is the way most networks use these paths.

A network of six routers, R1 to R6, joined by lines, between a sending phone on the left and a receiving laptop on the right. Packet 1 and packet 3 travel along the top route through R1, R2 and R3. Packet 2 travels along the bottom route through R4, R5 and R6. At the laptop the packets arrive in the order 1, 3, 2 and are then sorted into the order 1, 2, 3.

The steps of packet switching are these.

  1. The data is broken down into packets.
  2. Each packet could take a different route to the destination.
  3. A router controls the route a packet takes. It reads the destination address in the header and sends the packet on to the next router.
  4. The packets may arrive out of order, because some routes are faster or busier than others.
  5. Once the last packet has arrived, the packets are reordered using their packet numbers.

In the picture, packets 1 and 3 go along the top route and packet 2 goes along the bottom route. Packet 3 arrives before packet 2. The receiver waits for all the packets and then sorts them by packet number.

Why is this a good plan? If one router is busy or broken, packets can go round it. No single line is tied up for the whole message, so many users can share the network. If one packet is lost or damaged, only that packet must be sent again. The cost is that packets can arrive out of order, so they must be reordered at the end.

Practise with new numbers

Try it in Python

The program cuts a short message into packets of 666 characters. Each packet gets a header with a destination, a packet number and an originator. The packets then arrive in a mixed-up order, and the program sorts them by packet number.

Read it first. Then run it. Look at the arrival order and at the rebuilt message.

1. Change payload_size = 6 to payload_size = 4. How many packets are there now? The program will stop with an error: why?

2. Change the arrival order in Step 3 to fit the new number of packets, and run it again.

Common mistakes

  • Saying the payload is in the header. The header holds addresses and the packet number. The payload is the data.
  • Forgetting the packet number. Without it, the receiver could not put the packets back in order.
  • Saying all packets take the same route. In packet switching, each packet could take a different route.
  • Saying the packets are reordered as they arrive. They are reordered once the last packet has arrived.

Remember these

  • A packet has a header, a payload and a trailer.
  • The header holds the destination address, the packet number and the originator's address.
  • A router controls the route of each packet.
  • Packets may arrive out of order and are reordered when the last one has arrived.

Check yourself

Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.

  1. Name the three parts of a packet, in order from start to end.
  1. Which part of a packet holds the piece of the photo being sent?
  1. Why does the header hold a packet number?
  1. A file of 420042004200 bytes is sent in packets with a payload of at most 100010001000 bytes. How many packets are needed?
  1. What device reads the destination address of a packet and decides where to send it next?

Enroll free in Packets and Methods of Data Transmission

Every lesson is open to read. Enrolling also lets you:

  • Mark lessons done and carry on where you stopped.
  • Take the tests of this lesson and its course.
  • Count the course towards the certificate for its chapter.
No payment. You can leave at any time.

Problems (4)

Amara emails a school report of 7300 bytes…Easy · High School (9–10) · by StemPy Lab
A song file of 5500 bytes is sent in packets with a payload of at most 500 bytes…Medium · High School (9–10) · by StemPy Lab
A message is sent as 6 packets, numbered 1 to 6…Hard · High School (9–10) · by StemPy Lab
Next: lesson 2Serial and parallel, simplex and duplex
← Packets and Methods of Data Transmission
← PreviousSerial and parallel, simplex and duplex →

Discussion (0)

Log in to join the discussion.

Loading…

1 Python program
5 questions to check yourself

This lesson is free to read. Enroll free to keep your place and take the tests.

A photo of 36 000 bytes is sent in 24 packets of equal size…
Medium · High School (9–10) · by StemPy Lab

Python Labs (1)

Cut a message into packets and rebuild itPython Lab · by StemPy Lab