Protocols and Packet Switching
You can read this note directly if you know that networks carry data between devices. This note explains the rules and transmission model that make communication work.
Beginner Problem
Two computers can be connected by a cable or wireless link and still fail to communicate meaningfully if they do not follow the same rules.
Example:
One side sends: 01001000 01001001
The other side must know whether those bytes mean text, a number, an image fragment,
or part of a larger message.Protocols provide the shared rules needed to interpret and manage communication.
Why Protocols Are Needed
A protocol is a set of communication rules.
Protocols define things such as:
- message format;
- addressing;
- ordering;
- error handling;
- when a connection starts and ends;
- what each side should do after receiving data.
Without a shared protocol, two devices may send bytes but fail to understand each other.
TCP/IP Roles
| Protocol | Main role |
|---|---|
| IP | routes packets using IP addresses |
| TCP | provides reliable ordered delivery between processes |
| Ethernet | sends frames across a local network link |
| HTTP | defines web request and response messages |
| SMTP | sends email between mail systems |
| POP/IMAP | retrieves or manages email for users |
Beginner idea: protocols work together. A web request may use HTTP messages carried over TCP, which uses IP packets.
Layered example:
| Layer of idea | Example role |
|---|---|
| application message | HTTP says what web resource is requested |
| transport | TCP keeps the byte stream reliable and ordered |
| network | IP routes packets to the destination host |
| local link | Ethernet or Wi-Fi carries frames on the local network |
TCP/IP Layer Model
The anchor uses five layers. Some references combine the last two as a single network-access layer; this creates a four-layer version without changing the underlying responsibilities.
Some exam questions refer to TCP/IP layers by name. Use this as a syllabus-level model, not as a full professional networking course.
| TCP/IP layer | Main responsibility | Example protocols or technologies |
|---|---|---|
| application | rules for application messages and services | HTTP, SMTP, DNS |
| transport | process-to-process delivery, reliability where needed | TCP, UDP |
| internet | addressing and routing packets between networks | IP |
| link | frame delivery between adjacent devices | Ethernet, Wi-Fi |
| physical | transmission of bits as physical signals | electrical, radio, optical media |
| network access | moving frames across the local physical or wireless link | Ethernet, Wi-Fi |
The key idea is separation of responsibilities. For example, HTTP defines the web request, TCP manages reliable ordered delivery, IP routes packets across networks, and Ethernet or Wi-Fi carries data across the local link.
Common exam wording:
| If asked about… | Answer focus |
|---|---|
| protocol | agreed rules for communication |
| IP | addressing and routing packets |
| TCP | reliable ordered delivery between processes |
| router | forwarding packets between networks |
| layers | each layer handles a different part of communication |
Packet Switching
Packet switching splits data into smaller units that routers can forward independently.
Caption: Each route is one possible next-hop path through shared links. A router stores a packet briefly, reads destination and control information, and forwards it using its routing table. Queueing can cause variable delay; congestion may cause loss; different packets may arrive out of order. TCP or application logic provides recovery and reordering where required.
An IP packet can include:
- source address;
- destination address;
- protocol information;
- a hop limit, called TTL in IPv4, which prevents indefinite circulation;
- payload data.
If TCP is used, its segment header carries sequence information. At the destination, the appropriate transport or application logic reorders or reassembles data where needed.
Beginner analogy: a long document can be mailed as several envelopes. Each envelope needs an address and ordering information. The receiver can put the pieces back together.
Routing
Routers forward packets from one network to another. A router does not need to know the whole original message. In store-and-forward operation it receives a packet, may queue it briefly, reads destination/control information, and uses a routing table to choose the next hop. Shared links improve utilisation, but congestion can increase queueing delay or cause packet loss.
Trace idea:
| Step | What happens |
|---|---|
| 1 | sender splits data into packets |
| 2 | each packet gets header information |
| 3 | routers forward packets toward destination |
| 4 | packets may arrive in a different order |
| 5 | destination uses protocol information to handle or reassemble data |
Packet Loss
Packets can be lost because of congestion, errors, or network failure.
TCP can detect missing data and arrange retransmission. This is one reason TCP is used for applications where reliable ordered delivery matters.
Not every protocol handles loss the same way. The syllabus focus here is that packet-switched networks can lose packets, and higher-level protocols may need to detect and recover from that.
Packet Switching Versus Circuit Switching
| Feature | Packet switching | Circuit switching |
|---|---|---|
| path | packets may take different routes | dedicated path is reserved |
| resource use | shared between many communications | reserved for one communication |
| good for | bursty data such as internet traffic | continuous dedicated communication |
| weakness | packets may be delayed or lost | inefficient if reserved path is idle |
Common Mistakes
- Saying TCP and IP do the same job.
- Saying every packet must take the same route.
- Forgetting that packets contain headers as well as data.
- Thinking packet switching guarantees no packet loss.
- Treating HTTP as a low-level routing protocol.
Check Your Understanding
- Why are protocols needed?
- What is the role of IP?
- What is the role of TCP?
- Why can packet switching use network resources efficiently?
Answers:
- They provide agreed rules so devices can interpret messages correctly.
- Routing packets using IP addresses.
- Reliable ordered delivery between processes.
- Packets from many communications can share network links.