P

Protocols

Communication rules and standards for networked systems

Learning Objectives

By the end of this lesson, you will be able to:

  • Explain why a protocol is essential for communication between computers
  • Understand how protocol implementation can be viewed as a stack
  • Describe the TCP/IP protocol suite and its four layers
  • Explain the purpose and function of each TCP/IP layer
  • Understand key protocols (HTTP, FTP, POP3, IMAP, SMTP, BitTorrent) and their purposes
  • Explain how the BitTorrent protocol provides peer-to-peer file sharing
  • Trace the path of a message sent from one host to another on the internet

Key Terms

  • Protocol - A set of rules for data transmission agreed by sender and receiver for successful transmission over a network.
  • Protocol Stack - A collection of related protocols organized in layers, where each layer has specific functionality.
  • TCP/IP - Transmission Control Protocol/Internet Protocol - the fundamental communication protocol suite for the internet.
  • Packet - A small group of bits into which messages are split for transmission over a network.
  • Router - A network device that forwards data packets between computer networks.
  • Peer-to-Peer (P2P) - A distributed application architecture that partitions tasks or workloads between peers.

What Are Protocols?

A protocol is a set of rules for data transmission which are agreed by sender and receiver for successful transmission of data over a network.

Protocols are essential for communication between computers because they establish a standardized set of rules, conventions, and procedures that enable consistent and reliable data exchange. Without protocols, computers wouldn't be able to understand each other's messages, leading to disordered and ineffective communication.

Why Protocols Matter

Protocols enable:

  • Standardized communication independent of software and hardware used
  • Communication between devices from different manufacturers/platforms
  • Consistent data exchange format and timing
  • Error detection and correction mechanisms
  • Efficient routing and delivery of data packets

Exam Tip

If two devices were sending messages to each other but using different protocols, they would not be able to communicate properly. Always mention standardization and interoperability when explaining why protocols are essential.

Protocol Stack

A Protocol Suite is a collection of related protocols. For a protocol suite, protocols can be viewed as layers within a protocol stack.

Protocol Stack Characteristics

  • Each layer can only accept input from the next higher layer or next lower layer
  • There is a defined interface between adjacent layers
  • A layer is serviced by the actions of lower layers
  • Except for the bottom layer, each layer's job is done by software
  • A layer may comprise sub-layers
  • User interaction uses protocols in the highest layer
  • Direct hardware access is confined to the lowest layer

Data Flow in Protocol Stack

Sending Data
Application Layer (4)
Transport Layer (3)
Internet Layer (2)
Link Layer (1)
Network
Receiving Data
Network
Link Layer (1)
Internet Layer (2)
Transport Layer (3)
Application Layer (4)
Sending Layers
Receiving Layers
Downward Flow (Send)
Upward Flow (Receive)

Using layers breaks down the communication process into manageable self-contained modules, making it easier to develop software and ensure hardware compatibility. This process is known as decomposition.

Activity 14A: Protocol Stack Understanding

Difficulty: Easy • Estimated time: 5 minutes

Explain why a protocol stack uses layers. What are the advantages of this layered approach compared to having a single protocol handle all communication tasks?

Why layers are used: Layers break down the complex communication process into manageable, self-contained modules. Each layer has a specific responsibility and interacts only with adjacent layers.

Advantages:

  • Simplifies development and maintenance (modularity)
  • Allows different layers to be developed independently
  • Enables hardware/software compatibility across different systems
  • Facilitates troubleshooting by isolating problems to specific layers
  • Allows protocols to be updated or replaced in one layer without affecting others
  • Makes the system more scalable and flexible

TCP/IP Protocol Suite

The TCP/IP protocol suite is the fundamental communication protocol of the internet. It consists of four layers, each with specific responsibilities:

Layer Name Purpose & Function Key Protocols Data Unit
4 Application Layer Provides network services to applications, defines protocols for data exchange HTTP, FTP, SMTP, POP3, IMAP Message
3 Transport Layer Ensures reliable data transfer, breaks data into packets, manages connections TCP, UDP Segment
2 Internet Layer Handles routing of packets across networks, logical addressing IP, ICMP, IGMP Datagram
1 Link Layer Physical transmission of data, network interface, hardware addressing Ethernet, WiFi, Bluetooth Frame

TCP - Transmission Control Protocol

TCP is responsible for breaking data down into small packets before they can be sent over a network, and for assembling the packets again when they arrive.

  • Connection-oriented protocol
  • Ensures reliable delivery with error checking
  • Uses sequence numbers and acknowledgements
  • Implements flow control
  • Re-transmits lost or corrupted packets

IP - Internet Protocol

IP takes care of communication between computers. It is responsible for addressing, sending and receiving the data packets over the Internet.

  • Connectionless protocol
  • Handles logical addressing (IP addresses)
  • Routes packets across networks
  • Does not guarantee delivery (best-effort service)
  • Fragments packets if necessary

Important Distinction

TCP is responsible for reliable data transfer (ensuring packets arrive correctly and in order), while IP is responsible for routing packets across networks (getting them from source to destination). They work together but have separate responsibilities.

Application Layer Protocols

The Application Layer is the top layer of TCP/IP. It contains all programs that exchange data, such as web browsers or server software. This layer allows applications to access services used in other layers and defines protocols for data exchange.

HTTP - Hypertext Transfer Protocol

HTTP is the most important application layer protocol. Essentially, this protocol underpins the World Wide Web. It is used when fetching an HTML document from a web server.

  • Client/server protocol (browser = client, web server = server)
  • Defines format of request and response messages
  • Uses port 80 (HTTP) or 443 (HTTPS)
  • Stateless protocol (each request is independent)

FTP - File Transfer Protocol

FTP is the application-layer protocol that can handle any file transfer between two end-systems, even with different operating systems and file systems.

  • Separates control process from data-transfer process
  • Supports anonymous FTP (access without identification)
  • Allows file management commands on server
  • Uses port 21 for control, port 20 for data

SMTP - Simple Mail Transfer Protocol

SMTP is a text-based, connection-based protocol used when sending emails. It is referred to as a push protocol because a client opens a connection to a server and keeps it active.

  • Text-based only (doesn't handle binary files directly)
  • Uses MIME (Multi-purpose Internet Mail Extension) for attachments
  • Push protocol (client uploads email to server)
  • Uses port 25

POP3/IMAP - Email Retrieval

Post Office Protocol (POP3/4) and Internet Message Access Protocol (IMAP) are protocols used when receiving emails from email server. These are known as pull protocols.

Protocol Key Feature Synchronization
POP3/4 Downloads emails to client, then deletes from server No synchronization
IMAP Downloads copy, original remains on server Keeps server and client synchronized

Activity 14B: Protocol Selection

Difficulty: Medium • Estimated time: 8 minutes

For each scenario below, identify the most appropriate application layer protocol and explain your choice:

  1. Downloading a large software update file from a company server
  2. Reading emails on your phone while keeping them accessible on your laptop
  3. Sending an email with a photo attachment to a friend
  4. Accessing a secure banking website
  1. FTP (File Transfer Protocol) - FTP is specifically designed for transferring files between systems, especially large files. It handles different file systems and provides reliable file transfer.
  2. IMAP (Internet Message Access Protocol) - IMAP keeps emails synchronized across multiple devices. When you read an email on your phone, it will show as read on your laptop too, and emails remain on the server.
  3. SMTP (Simple Mail Transfer Protocol) - SMTP is used for sending emails. With MIME extensions, it can handle attachments including photos.
  4. HTTPS (HTTP Secure) - HTTPS is the secure version of HTTP used for accessing websites that require encryption, such as banking sites. It uses SSL/TLS encryption to protect data.

BitTorrent - Peer-to-Peer File Sharing

BitTorrent is a protocol based on Peer-to-Peer networking concept. This allows very fast sharing of files between computers (known as peers).

How BitTorrent Works:
  • File is broken into equal segments called pieces
  • Creator makes a torrent file containing metadata
  • Peers connect to a tracker (central server with peer info)
  • Peers download pieces from multiple sources simultaneously
  • Once a peer has a piece, it becomes a source for that piece
  • Complete file downloaders become seeds
BitTorrent Terminology:
  • Swarm: Group of peers connected together
  • Seed: Peer with complete file who shares it
  • Leech: Peer who downloads more than uploads
  • Lurker: Peer who downloads but doesn't share new content
  • Tracker: Server storing peer IP addresses

Note: File pieces may not be downloaded sequentially and have to be rearranged in the correct order by the BitTorrent protocol to produce the final file.

Transport & Internet Layers

Transport Layer

The transport layer regulates network connections and ensures reliable data transfer. This is where data is broken up into packets which are then sent to the internet/network layer.

TCP - Transmission Control Protocol

  • Connection-oriented protocol
  • Ensures packets arrive in sequence, without errors
  • Uses acknowledgements and retransmission (PAR)
  • Reliable but slower due to overhead
  • Used for web browsing, email, file transfer

UDP - User Datagram Protocol

  • Connectionless protocol
  • Provides simpler but unreliable service
  • No acknowledgements or retransmission
  • Faster with less overhead
  • Used for streaming, gaming, DNS queries

Internet Layer

The main purpose of this layer is to organize or handle movement of data on the network (routing). The main protocol used at this layer is IP (Internet Protocol).

IP - Internet Protocol

  • Handles logical addressing (IP addresses)
  • Routes packets across networks
  • Connectionless service
  • Does not guarantee delivery
  • Fragments packets if necessary

Other Internet Layer Protocols

  • ICMP - Internet Control Message Protocol: Error-reporting protocol used by routers
  • IGMP - Internet Group Management Protocol: Establishes multicast group memberships
  • ARP - Address Resolution Protocol: Maps IP addresses to MAC addresses

Packet Terminology at Different Layers

The same data unit is called different names at different layers as each layer adds its own header:

Layer Name Description
Transport Layer Segment TCP breaks data into segments with sequence numbers
Internet Layer Datagram IP adds source/destination addresses creating datagrams
Link Layer Frame Data link layer adds physical addresses creating frames

Key Takeaways

  • Protocols are essential standardized rules for communication between computers
  • Protocols ensure interoperability between different hardware and software systems
  • The TCP/IP protocol suite uses a 4-layer model: Application, Transport, Internet, Link
  • Application layer protocols include HTTP (web), FTP (file transfer), SMTP (email sending), POP3/IMAP (email retrieval)
  • BitTorrent is a peer-to-peer file sharing protocol that uses swarms and seeds
  • Transport layer protocols: TCP (reliable, connection-oriented) and UDP (fast, connectionless)
  • Internet layer protocols: IP (routing), ICMP (error reporting), IGMP (multicast)
  • Link layer protocols: Ethernet (wired LANs), WiFi (wireless LANs), Bluetooth (short-range)
  • Data has different names at each layer: segments (transport), datagrams (internet), frames (link)
  • Routers forward packets between networks using IP addresses; switches forward frames within networks using MAC addresses

Question Bank

Marking Scheme
  • [2 marks] Definition: A set of rules for data transmission agreed by sender and receiver for successful transmission over a network.
  • [3 marks] Importance:
    • Establishes standardized rules for consistent data exchange
    • Enables communication between devices from different manufacturers
    • Without protocols, computers cannot understand each other's messages
    • Provides error detection and correction mechanisms
Additional Notes for Slow Learners
  • Think of protocols like language rules - if two people don't speak the same language with the same grammar, they can't communicate
  • Protocols ensure all devices on a network "speak the same language" with the same rules
  • Without protocols, it would be like trying to have a conversation where everyone makes up their own words and grammar
Marking Scheme
  • [2 marks each layer] For each layer:
    • Application Layer (4): Provides network services to applications. Protocol example: HTTP, FTP, SMTP
    • Transport Layer (3): Ensures reliable data transfer, breaks data into packets. Protocol example: TCP, UDP
    • Internet Layer (2): Handles routing of packets across networks. Protocol example: IP, ICMP
    • Link Layer (1): Physical transmission of data, network interface. Protocol example: Ethernet, WiFi
Additional Notes for Slow Learners
  • Think of the layers like sending a letter:
    • Application = Writing the letter (content)
    • Transport = Putting it in an envelope with address
    • Internet = Post office sorting and routing
    • Link = Mail van delivering to address
  • Each layer has a specific job and only talks to the layers above and below it
Marking Scheme
  • [2 marks] Similarities:
    • Both are transport layer protocols
    • Both break data into packets for transmission
  • [4 marks] Differences:
    • TCP is connection-oriented, UDP is connectionless
    • TCP ensures reliable delivery with acknowledgements, UDP does not
    • TCP has error checking and retransmission, UDP does not
    • TCP is slower but reliable, UDP is faster but unreliable
    • TCP used for web, email, file transfer; UDP used for streaming, gaming, DNS
Additional Notes for Slow Learners
  • TCP is like sending a registered letter - you get confirmation it arrived, but it's slower
  • UDP is like shouting across a crowded room - fast, but no guarantee the person heard you
  • For important things (bank transfers, emails) use TCP
  • For real-time things (video calls, games) use UDP (losing a few packets is OK)
Marking Scheme
  • [1 mark] File is broken into equal pieces
  • [1 mark] Creator makes a torrent file with metadata
  • [1 mark] Peers connect to a tracker server
  • [1 mark] Peers download pieces from multiple sources simultaneously
  • [1 mark] Once a peer has a piece, it becomes a source for that piece
  • [1 mark] Complete downloaders become seeds that share the full file
Additional Notes for Slow Learners
  • Think of BitTorrent like a potluck dinner:
    • Everyone brings a different dish (file piece)
    • You can get a complete meal by taking from multiple people
    • Once you've eaten, you can share your dishes too
    • The more people sharing, the faster everyone gets fed
  • This is different from traditional downloading where everyone goes to one kitchen (server)
Marking Scheme
  • [1 mark each] For each valid difference:
    • HTTP is for web page transfer, FTP is for general file transfer
    • HTTP is stateless, FTP maintains state during session
    • HTTP uses single connection, FTP uses separate control and data connections
    • HTTP typically uses port 80/443, FTP uses ports 20/21
    • HTTP is text-based, FTP can handle binary files directly
    • FTP supports file management commands, HTTP does not
Additional Notes for Slow Learners
  • HTTP is like going to a library to read a book - you get the content but can't modify it
  • FTP is like going to a storage unit - you can take things, put things, and organize things
  • Web browsers use HTTP to view websites
  • File managers use FTP to upload/download files to servers
Marking Scheme
  • [2 marks] POP3 downloads emails to client then deletes from server
  • [2 marks] IMAP downloads a copy, original remains on server and keeps synchronization

Key difference: POP3 does not keep server and client synchronized; IMAP keeps them synchronized.

Additional Notes for Slow Learners
  • POP3 is like getting physical mail - once you take it from the mailbox, it's gone from there
  • IMAP is like checking mail online - you can see it on your phone, laptop, anywhere, and it stays in the online mailbox
  • Use POP3 if you only check email on one device
  • Use IMAP if you check email on multiple devices (phone, laptop, tablet)
Marking Scheme
  • [2 marks] Purpose: SMTP is used for sending emails between servers/clients
  • [1 mark] SMTP is text-based only and cannot handle binary files directly
  • [2 marks] Attachments handled using MIME (Multi-purpose Internet Mail Extension) protocol which encodes binary files as text
Additional Notes for Slow Learners
  • SMTP is like a postal service that only accepts letters (text)
  • To send a package (attachment), you need to put it in a special box (MIME encoding) that makes it look like a letter
  • The receiver then unpacks the box to get the original attachment
  • This is why email attachments sometimes look like weird text - they're encoded
Marking Scheme
  • [2 marks] Router operates at Internet layer (Layer 3), uses IP addresses to route between networks
  • [2 marks] Switch operates at Link layer (Layer 2), uses MAC addresses to forward within a network

Key difference: Routers connect different networks, switches connect devices within the same network.

Additional Notes for Slow Learners
  • Router = Post office between cities (decides which city/town to send to)
  • Switch = Mail sorter within a post office (decides which street/address)
  • Your home router connects your home network to the internet (different networks)
  • A switch in an office connects all the computers in that office (same network)
Marking Scheme
  • [2 marks] Protocol stack: Collection of related protocols organized in layers
  • [4 marks] Advantages of layered approach:
    • Breaks complex process into manageable modules (decomposition)
    • Allows independent development of each layer
    • Enables hardware/software compatibility
    • Facilitates troubleshooting by isolating problems
    • Allows protocols to be updated without affecting other layers
Additional Notes for Slow Learners
  • Think of a protocol stack like a team working on a project:
    • Each person (layer) has a specific job
    • They only talk to the person above/below them
    • If someone leaves, you can replace just that person
    • If there's a problem, you know which person to fix
  • This is much better than one person trying to do everything!
Marking Scheme
  • [1 mark] User enters URL in browser
  • [1 mark] DNS server looks up domain name to find IP address
  • [1 mark] HTTP request sent from application layer to transport layer
  • [1 mark] TCP breaks request into packets with sequence numbers
  • [1 mark] IP adds source/destination addresses and routes packets
  • [1 mark] Link layer transmits frames over physical network
  • [1 mark] Web server receives request, processes it, sends response
  • [1 mark] Browser receives response, renders web page
Additional Notes for Slow Learners
  • Think of it like ordering a pizza:
    • You call (HTTP request) and give your address (URL)
    • The restaurant looks up your address (DNS)
    • They write down your order (TCP packets)
    • They put it in a delivery bag with addresses (IP routing)
    • The driver brings it to you (Link layer transmission)
    • You get your pizza and eat it (browser renders page)
  • Each step happens at a different layer of the protocol stack