Application Layer
Application layer
The application layer provides the interface between applications and the network.
It defines protocols that applications use to exchange data, such as:
- HTTP for web browsing
- SMTP for email
- DNS for domain name resolution
Transport Layer
Transport layer
The transport layer ensures reliable communication between hosts.
It uses protocols like:
- TCP (Transmission Control Protocol): Provides reliable, ordered, and error-checked delivery.
- UDP (User Datagram Protocol): Offers faster, but less reliable, communication.
Internet Layer
Internet layer
The internet layer handles packetization, addressing, and routing.
Its primary protocol is IP (Internet Protocol), which:
- Assigns unique IP addresses to devices
- Routes packets across networks
Network Interface Layer
Network interface layer
The network interface layer deals with the physical transmission of data.
It includes:
- Data framing: Encapsulating packets into frames
- MAC addressing: Ensuring data reaches the correct device on a local network
Interaction Between Layers
Each layer of the TCP/IP model performs a specific function, but they work together to ensure reliable data transmission:
- Application Layer: Prepares data for transmission (e.g., an HTTP request).
- Transport Layer: Segments data and adds error-checking information.
- Internet Layer: Encapsulates segments into packets with IP addresses.
- Network Interface Layer: Converts packets into signals for physical transmission.
Step-by-Step: Sending a File from Computer A to B
On Computer A
- Application Layer (User level)
- This is where the file transfer starts.
- The user on Computer A uses a program (e.g. a browser, FTP client, or email app) to send the file.
- The application adds its own header with information like:
- The type of data (e.g. file, text, video)
- The protocol used (e.g. HTTP, FTP, SMTP)
- Transport Layer (Process-to-process communication)
- The data from the application is passed to the Transport Layer.
- TCP (Transmission Control Protocol) is used for reliable delivery.
- The data is broken into smaller segments.
- Each segment gets:
- A TCP header with source and destination port numbers.
- A sequence number so segments can be reassembled correctly.
- Error-checking info.
- TCP also starts a handshake between A and B to establish a connection.
- Internet Layer (Host-to-host communication)
- Each segment is passed to the Internet Layer.
- This layer uses the IP protocol (Internet Protocol).
- Adds an IP header to create a packet.
- Contains source and destination IP addresses.
- If the packet is too large for the next network, it may be fragmented.
- Network Interface Layer / Link Layer (Hardware-to-hardware, local delivery)
- The packet is passed to the Network Interface Layer.
- This layer deals with actual hardware and transmission.
- The packet is turned into frames and sent over the network.
- Each frame includes:
- MAC addresses (unique IDs for physical devices).
- Start and end markers.
- The data travels over Ethernet, Wi-Fi, fibre optic, etc.
On the way to Computer B…
- Routers use the IP address to forward packets toward Computer B.
- Each router strips and rebuilds the Link Layer frame as needed.
On Computer B (the receiving end)…
- The Network Interface Layer (Link Layer) reads the MAC address, removes the frame header, and passes the packet up.
- The Internet Layer checks the IP address, removes the IP header, and passes the segment up.
- The Transport Layer reassembles the segments using sequence numbers, checks for errors, and sends the data to the correct application using the port number.
- The Application Layer receives the reassembled data and makes the file available to the user.
- Connection and handshake is terminated.
Ensuring Reliable Data Transmission
The TCP/IP model's layered approach provides several mechanisms for reliability:
- Error Checking: Checksums and acknowledgments ensure data integrity.
- Sequencing: TCP orders packets to reconstruct data correctly.
- Retransmission: Lost or corrupted packets are resent.