📘 CodingMarble Learn

Network Protocols and the TCP/IP Model

A protocol is a set of rules that devices agree on so they can talk to each other. Networking is split into four layers (the TCP/IP model). The Application layer has protocols that apps use: HTTP and HTTPS for web pages, SMTP to send email and IMAP to read email kept on a server. The Transport layer (TCP) splits data into numbered packets, checks them and resends any that are lost. The Internet layer (IP) adds addresses and routes packets. The Link layer sends the bits over a cable (Ethernet) or by radio (Wi-Fi). Going down the stack each layer adds a header; going up on the other side each header is removed. Layers make networks easier to build and change, because each layer only needs to talk to the layer just above and below it.

🎬 Step-by-step story

  1. A protocol is an agreed set of rules. Two computers can only understand each other if they follow the same rules.
  2. The work of sending data is split into four layers. Each layer does one job.
  3. The top layer is the Application layer. HTTP and HTTPS carry web pages. SMTP sends email. IMAP reads email from a server.
  4. The Transport layer uses TCP. It breaks a message into numbered packets. If a packet is lost, it is sent again.
  5. The Internet layer (IP) adds addresses. The Link layer sends the data by cable (Ethernet) or radio (Wi-Fi). Each layer wraps the data going down and unwraps it going up.
  6. Free play: pick a protocol, see which layer it lives in, and send a message.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Why do we need protocols at all?

Devices are made by different companies. Without shared rules about format, addressing and errors, one device could not understand another.

Why split networking into layers?

Each layer does one job and only talks to its neighbours, so it is easier to build, fix and change.

What is the difference between SMTP and IMAP?

SMTP sends email out. IMAP reads email that stays stored on the mail server.

What happens when a packet is lost?

TCP notices the missing number and sends that packet again, then puts all packets in order.

Is the packet changed as it goes through the layers?

The data inside stays the same, but each layer adds a header going down and removes it going up.

Are Ethernet and Wi-Fi in different layers?

No. Both are Link-layer protocols; one uses cables and the other uses radio.

What is a protocol?

A protocol is a set of rules for how data is sent and received. The rules say things like:

Think of two people talking. If one speaks Tamil and the other only Spanish, nothing gets through. Devices made by different companies can talk because they all follow the same standard protocols.

The four-layer TCP/IP model

Networking is a big job, so it is split into layers. Each layer does one job and uses the layer below it.

LayerJobExample protocols
4. ApplicationGives services to apps (web, email, file transfer)HTTP, HTTPS, SMTP, IMAP, FTP
3. TransportSplits data into packets, numbers them, checks they arrive, resends lost onesTCP, UDP
2. InternetAdds IP addresses and routes packets between networksIP
1. LinkSends bits over the physical connection inside one networkEthernet, Wi-Fi

Why use layers?

Wrapping and unwrapping

Going down the sender's stack, each layer adds its own header (extra information such as port numbers or addresses). Going up the receiver's stack, each layer removes its header. This is called encapsulation.

Application and transport protocols: TCP/IP, HTTP, HTTPS, SMTP, IMAP

TCP/IP is the name for the whole family of protocols used on the internet, named after its two most important members.

Link layer: Ethernet and Wi-Fi

Both live in the Link layer. The layers above do not care which one is used.

Try it: follow a web page through the layers

  1. You type a web address. The browser uses HTTPS (Application).
  2. TCP splits the request into packets and numbers them (Transport).
  3. IP adds the server's address (Internet).
  4. Wi-Fi sends the frames to your router by radio (Link).
  5. At the server, each layer removes its header, going up, until the web server reads the request.

Now try it in the 3D free play with different protocols.

Key formulas and definitions

Worked examples

1. Which layer does SMTP belong to, and what does it do?

SMTP is in the Application layer. It sends email from your device to your mail server and between mail servers.

2. A file of 4,000 bytes is split into packets that each carry 1,000 bytes of data. How many packets does TCP send, and what happens if packet 3 never arrives?

4,000 ÷ 1,000 = 4 packets, numbered 1 to 4. The receiver notices number 3 is missing and does not confirm it, so TCP sends packet 3 again. The packets are then put back in order 1, 2, 3, 4.

3. Your school replaces all network cables with Wi-Fi. Which layer changes? Does the web browser need to change?

Only the Link layer changes (Ethernet → Wi-Fi). The browser (Application layer) does not change, because each layer is independent. This is one key benefit of layering.

4. Why should an online shop use HTTPS and not HTTP?

HTTPS encrypts the data, so card details and passwords cannot be read if someone intercepts the packets. HTTP sends plain text that anyone listening could read.

Common mistakes

Practice quiz

1. What is a protocol?
2. Which protocol is used to send an email?
3. Which layer adds IP addresses and routes packets?
4. What does TCP do if a packet is lost?
5. Ethernet and Wi-Fi are both in which layer?

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What are the 4 layers of the TCP/IP model?

Application, Transport, Internet and Link (from the top).

What is the difference between HTTP and HTTPS?

HTTPS is HTTP with encryption, so data like passwords cannot be read if intercepted.

Is TCP/IP one protocol?

No. It is a family (suite) of protocols, named after TCP and IP, used across the internet.

Where this is taught

England (GCSE, A level)Year 113.5 Fundamentals of computer networks
China八年级(初二)Module: Internet applications and innovation (review/extension)

Learn first

Learn next

Related lessons

All Computer Science lessons