4 Transport Layer and Application Layer 7
4.1 Transport Layer: Service primitives, Sockets, Connection management
(Handshake), UDP, TCP, TCP state transition, TCP timers, TCP Flow control
(sliding Window)
4.2 Application Layer: HTTP, SMTP, Telnet, FTP, DHCP, DNS and Types of
Name Server
Transport Layer:
The Transport Layer is the fourth layer of the OSI model and is responsible for end-to-end communication and data transfer between applications on different devices. It ensures the reliable and efficient delivery of data across the network.
Service Primitives:
Service primitives are the basic operations provided by the Transport Layer to the application layer. These primitives include:
- PDU (Protocol Data Unit): This represents the unit of data exchanged between the Transport Layer entities. In most cases, it is either a segment (TCP) or a datagram (UDP).
- Request: The operation by which the application layer requests a service from the Transport Layer.
- Indication: The operation by which the Transport Layer informs the application layer that a requested service has been completed.
Sockets:
A socket is a software endpoint that establishes communication between two processes on different devices. Sockets are identified by an IP address and a port number. They provide a mechanism for processes on different devices to communicate over a network.
- IP Address: Identifies the device.
- Port Number: Identifies the process or service on the device.
Connection Management (Handshake):
Connection management involves the establishment, maintenance, and termination of a connection between two devices. In TCP, a three-way handshake is commonly used for connection establishment:
- SYN (Synchronize): The client sends a SYN segment to the server to initiate a connection.
- SYN-ACK (Synchronize-Acknowledge): The server responds with SYN-ACK, indicating its willingness to establish a connection.
- ACK (Acknowledge): The client acknowledges the server’s response, and the connection is established.
UDP (User Datagram Protocol):
UDP is a connectionless, unreliable transport protocol. It is simpler than TCP and does not involve the overhead of connection establishment and maintenance. However, it does not guarantee delivery or order of packets.
TCP (Transmission Control Protocol):
TCP is a connection-oriented, reliable transport protocol. It provides a reliable, byte-stream communication between two devices. TCP ensures data integrity, sequencing, and flow control.
TCP State Transition:
TCP has several states during the lifetime of a connection. The key states include:
- LISTEN: The initial state, waiting for a connection request.
- SYN-SENT: The client has sent a connection request and is waiting for an acknowledgment.
- SYN-RECEIVED: The server has received a connection request and sends an acknowledgment.
- ESTABLISHED: Connection is established, and data transfer can occur.
- FIN-WAIT-1, FIN-WAIT-2, TIME-WAIT, CLOSE-WAIT, LAST-ACK, CLOSED: Various states during connection termination.
TCP Timers:
TCP uses timers for various purposes, such as retransmission of lost packets and detecting idle connections. Examples include the Retransmission Timer and the Keep-Alive Timer.
TCP Flow Control (Sliding Window):
TCP flow control prevents a fast sender from overwhelming a slow receiver. It uses a sliding window mechanism where the sender can only send as many packets as the receiver’s window size allows. The window size can dynamically adjust based on network conditions.
Application Layer:
The Application Layer is the top layer of the OSI model and is responsible for providing network services directly to end-users or applications. It defines the protocols and methods that applications use to communicate over a network.
Protocols:
- HTTP (Hypertext Transfer Protocol):
- Purpose: Used for transmitting hypertext (web pages) on the World Wide Web.
- Characteristics: Stateless protocol, typically operates over TCP, and follows a client-server model.
- SMTP (Simple Mail Transfer Protocol):
- Purpose: Used for the transfer of electronic mail (email) between computers.
- Characteristics: Operates over TCP, and it is a text-based protocol for mail communication.
- Telnet:
- Purpose: Provides a text-oriented communication protocol over a TCP connection.
- Characteristics: Allows a user to log in and execute commands on a remote device as if directly connected.
- FTP (File Transfer Protocol):
- Purpose: Used for transferring files between hosts over a TCP-based network.
- Characteristics: Supports both active and passive data transfer modes, providing a way to upload and download files.
- DHCP (Dynamic Host Configuration Protocol):
- Purpose: Assigns dynamic IP addresses to devices on a network.
- Characteristics: Automates the process of IP address configuration, providing flexibility in network management.
- DNS (Domain Name System):
- Purpose: Resolves domain names to IP addresses, making it easier for users to access resources on the internet.
- Characteristics: Hierarchical structure with domain names organized in a tree-like fashion.
Types of Name Servers:
- Root Name Server:
- Role: Maintains a list of authoritative DNS servers for top-level domains (TLDs).
- Function: Responds to DNS queries by providing information about the authoritative name servers for the requested TLD.
- Top-Level Domain (TLD) Name Server:
- Role: Manages domain names at the top level of the DNS hierarchy.
- Function: Provides information about authoritative name servers for second-level domains within its TLD.
- Authoritative Name Server:
- Role: Holds authoritative information about a specific domain.
- Function: Responds to DNS queries with information about the domain’s IP addresses, mail servers, etc.
- Caching/Recursive Name Server:
- Role: Performs queries on behalf of clients and caches the results for a specified time.
- Function: Speeds up subsequent DNS queries by providing cached results, reducing the need to query authoritative servers for every request.