Communication and Internet Technologies
How data actually gets across the internet: protocols in layers, and circuit vs packet switching.
Why computers need protocols
A protocol is a set of rules both ends agree on, so different computers can understand each other.
A protocol is a set of rules that both ends agree on before they send data. It fixes:
- how the data is formatted and addressed
- the timing
- how errors are detected
- what happens when data is lost
Two computers from different makers, running different software, can understand each other. But only if they follow the same protocol.
Example:Without a protocol, the receiver would not even know where one message ends and the next one begins.
A stack of layers
Network software is a stack of layers; each layer does one job and can be changed on its own.
Network software is built as a protocol stack: protocols in layers, one on top of another.
Each layer:
- has one job
- uses the service of the layer below
- offers a service to the layer above
- does not need to know how the other layers do their work
It is like sending a letter. You write it, and the post office carries it. You do not need to know if it goes by truck or by plane.
Why build it this way?
- One layer can be replaced without changing the others.
- Each layer can be designed, built and fixed on its own.
Example:Wi-Fi can take the place of Ethernet at the bottom, and nothing above notices.
TCP/IP: four layers, one job each
TCP/IP has four layers, application, transport, internet and link, and each has one job.
| Layer (top to bottom) | Its job | Examples |
|---|---|---|
| Application | holds the protocols that programs use: what the program asks for | HTTP, FTP, SMTP, POP3, IMAP |
| Transport | splits the data into packets and adds sequence numbers and port numbers | TCP |
| Internet | adds the source and destination IP addresses, and routes each packet across networks | IP |
| Link | carries the packet across the local network, using hardware (MAC) addresses | Ethernet, Wi-Fi |
A sequence number shows each packet's place in the data. At the other end, TCP:
- acknowledges the packets (replies "received")
- asks again for any packet that is lost or damaged
- puts the packets back in order
So TCP makes sure every packet arrives.
Remember:An IP address together with a port number is called a socket.
One message, host to host
The sender wraps the message in layers; each router unwraps it only to the internet layer; the receiver unwraps it fully.
- Sending host: its layers wrap the message. Its link layer puts the frame (the wrapped packet) on the local network.
- Each router on the way unwraps it only as far as the internet layer. It reads the destination IP address and chooses the next hop (where to send it next).
- The router wraps the packet in a new link-layer frame for the next network.
- Destination host: the layers unwrap it in the opposite order.
- TCP puts the packets back in order by sequence number. It asks for any that are missing.
- Only then does the application receive the whole message.
Remember:A router does not unwrap the message all the way. It stops at the internet layer, because it only needs the IP address.
The protocols you must name
HTTP moves web pages, FTP moves files, SMTP pushes email out, and POP3 and IMAP pull it in.
| Protocol | What it does |
|---|---|
| HTTP | transfers web pages between a web server and a browser |
| HTTPS | HTTP made secure with TLS (topic 17) |
| FTP | transfers files between a client and a server, in either direction |
| SMTP | sends email: from your email program to your mail server, then from server to server |
| POP3 and IMAP | fetch email from the server |
A push protocol sends the data on: SMTP is one. A pull protocol fetches the data from the server: POP3 and IMAP are pull protocols.
| POP3 | IMAP | |
|---|---|---|
| Where messages go | downloaded to one device | left on the server |
| On the server | normally deleted | kept, so every device stays in step |
Example:You read school email on your phone and your laptop. IMAP keeps both the same.
BitTorrent: sharing without one big server
BitTorrent shares a large file in small pieces between many peers, so no single server carries the load.
BitTorrent is a peer-to-peer protocol (the computers share with each other) for large files. The file is split into small pieces.
| What it is | |
|---|---|
| .torrent file | a small file that describes the file: its name, a hash (a fingerprint) of every piece, and the address of a tracker |
| Tracker | a server that lists the peers sharing the file. It does not hold the file. |
| Swarm | the peers sharing the file |
| Seed | a peer that has the whole file |
| Leecher | a peer that is still downloading |
How it works:
- Each peer downloads different pieces from several peers at once.
- It also uploads the pieces it already has. So the load is shared.
- Every piece is checked against its hash.
Watch out:The file can be completed only while every piece is held by someone online.
Circuit switching
Circuit switching sets up one reserved path before any data is sent, and keeps it until the end.
In circuit switching, a dedicated circuit between the two ends is set up before any data is sent. Only these two ends use it, for the whole communication. It is released at the end.
| Good | Bad |
|---|---|
| all the data follows the same route and can use the circuit's whole bandwidth (how much data it carries per second) | the circuit stays reserved even when nobody is sending, and no one else can use it |
| data arrives in the order it was sent, at a steady rate | setting up the circuit takes time |
| no reassembly is needed | if a link fails, the connection is lost |
It is used where a guaranteed real-time path matters:
- traditional telephone calls
- private data lines
Packet switching
Packet switching splits a message into packets that travel on their own, maybe by different routes.
The message is split into packets. Each packet has two parts:
- a header: the source and destination IP addresses, a sequence number and an error check
- a payload: the data itself
How the packets travel:
- Each packet is sent on its own.
- Routers may send packets by different routes, so they can arrive out of order.
- The receiver reassembles them by sequence number. It asks again for any that are missing or damaged.
| Good | Bad |
|---|---|
| links are shared | delays vary |
| no set-up delay | lost packets must be sent again |
| packets can be rerouted round a failed link | reassembly takes time, and it suits real-time data less well |
Remember:The internet is packet switched.
What a router does
A router reads each packet's destination IP address and sends it on to the next hop.
A router connects networks and forwards packets between them. It is like a post office that reads the address and picks the next road.
For each packet, the router:
- examines the header and reads the destination IP address
- looks that address up in its routing table, which lists networks and the next hop towards each one
- sends the packet on that hop
- lowers the packet's hop limit, the TTL, by one, and discards the packet if the TTL reaches zero
The routing table is kept up to date as links get busy or fail. That is how packets get rerouted.
Remember:Because of the TTL, no packet can circle the network for ever.
Circuit or packet: choosing
Use circuit switching for a steady real-time stream; use packet switching for shared links and bursty data.
| Circuit switching | Packet switching | |
|---|---|---|
| Path | one, reserved first | each packet its own |
| Bandwidth | whole, fixed | shared, varies |
| Arrival | in the order sent | may be out of order |
| Set-up delay | yes | no |
| A link fails | connection lost | packets rerouted |
| Idle time | wasted | others use the link |
| Best for | real-time, steady data | bursty data, the internet |
Choose circuit switching when the whole bandwidth and an unbroken, in-order stream matter for the whole connection. Examples: a phone call, or a dedicated line between two sites.
Choose packet switching when many users share the links and the data comes in bursts. Examples: web pages, email and file transfer.
Exam:Name the property that decides it, not just the method.
- Click the stages below in the order they happen.
KEY TERMS
CHECK YOURSELF
1.Which is an advantage of packet switching over circuit switching?
2.Why is a layered protocol model useful?
3.You want the same mailbox to look identical on your phone and laptop. Which protocol?
4.What does a BitTorrent tracker do?
5.A router receives a packet. What does it use to choose the next hop?
6.Which TCP/IP layer splits the data into packets and adds sequence numbers?