× back
← Previous Topic

Transport Layer

Connection-Oriented and Connectionless Services in Transport Layer

Transmission Control Protocol (TCP) vs. User Datagram Protocol (UDP)

Services provided by the Transport Layer

The services provided by transport layer protocols can be categorized into five main areas:

User Datagram Protocol (UDP)

UDP Header

  • The UDP header is a fixed and simple 8-byte structure, in contrast to TCP, which can vary in size from 20 to 60 bytes.
  • The first 8 bytes of the UDP header contain all the necessary information, while the remaining part is dedicated to data transmission.
  • UDP port number fields are each 16 bits long, allowing for a port number range defined from 0 to 65535. Port number 0 is reserved for special purposes. These port numbers play a crucial role in distinguishing between different user requests or processes.
  • The UDP header consists of the following fields, each serving a specific purpose:
    1. Source Port: Identifies the port of the sender, helping in the proper routing of the response.
    2. Destination Port: Specifies the port of the intended recipient, guiding the delivery of the data.
    3. Length: Indicates the total length of the UDP datagram, including both the header and the data.
    4. Checksum: Facilitates error detection, ensuring the integrity of the transmitted data.

Applications of UDP:

  • Used for simple request-response communication when the data size is small, reducing concerns about flow and error control.
  • Suitable for multicasting due to its support for packet switching.
  • Utilized in routing update protocols like RIP (Routing Information Protocol).
  • Preferred for real-time applications that cannot tolerate uneven delays in message sections.
  • Implementations using UDP as a transport layer protocol include:
    • NTP (Network Time Protocol)
    • DNS (Domain Name Service)
    • BOOTP, DHCP
    • NNP (Network News Protocol)
    • Quote of the day protocol
    • TFTP, RTSP, RIP
  • Tasks performed by the application layer through UDP:
    • Trace Route
    • Record Route
    • Timestamp
  • UDP takes a datagram from the Network Layer, attaches its header, and swiftly sends it to the user, contributing to its fast operation.
  • UDP is considered a null protocol if you remove the checksum field, reducing the demand on computer resources.
  • Effective when using Multicast or Broadcast for data transfer.
  • Commonly employed for the transmission of real-time packets, particularly in multimedia applications.

Application Layer

Simple Mail Transfer Protocol (SMTP)

Working:

Characteristics of SMTP

  • Push Protocol: SMTP operates as a push protocol, meaning it initiates the transfer of data without waiting for a request. It actively pushes emails from the sender to the receiver.
  • Transport Layer: SMTP utilizes TCP (Transmission Control Protocol) at the transport layer, ensuring reliable and orderly data transmission.
  • Port Number: SMTP uses port number 25 to establish communication between the sender and the recipient's mail server.
  • Persistent TCP Connections: SMTP employs persistent TCP connections, allowing it to send multiple emails in a single connection, which enhances efficiency.
  • Connection Oriented: SMTP is a connection-oriented protocol, establishing a dedicated connection between the sender and the mail server for the duration of the email transfer.
  • In-Band Protocol: SMTP is an in-band protocol, meaning the control information and data share the same communication channel. This simplifies the communication process but may limit scalability.
  • Stateless Protocol: SMTP is a stateless protocol, implying that each email transaction is independent. The server does not retain information about the previous interactions, treating each email as a new transaction.

Important Points about SMTP

  • Text-Based Protocol: SMTP is a pure text-based protocol, meaning it can only handle messages containing 7-bit ASCII text. It is not designed to transfer other types of data like images, video, audio, executable files, binary objects, or text data in languages represented in 8-bit codes such as French, Japanese, Chinese, etc.
  • MIME Extension: Multipurpose Internet Mail Extensions (MIME) extends the limited capabilities of SMTP. It is an extension to the internet email protocol designed to enable users to send and receive graphics, audio files, video files, and other non-text data within email messages. MIME was specially designed for SMTP.
  • Stateless Protocol: SMTP is a stateless protocol, meaning it does not maintain the state of its clients. If an email is requested to be sent twice, the SMTP server resends it without recognizing that the email has already been sent.
  • Receiver's Side: SMTP is not used at the receiver's side. Instead, a pull protocol like POP3 or IMAP is needed. The receiver periodically checks if there are any new emails from the mail server.
  • Sender and Receiver Machines: SMTP is not run directly between sender and receiver machines. This is because machines cannot always be ON. The functionality has been divided between the client and the mail server. The mail server receives the mail on behalf of its client and manages the client's mailbox.
  • Client Authentication: SMTP is not suitable for client authentication, as it does not require authentication. It allows anyone on the Internet to send emails to anyone or even to a large group of people. SMTP Auth, short for SMTP Authentication, has been introduced separately to provide authentication features.

Post Office Protocol (POP)

Purpose

Working

  • To Retrieve a Message:
    • The client initiates a TCP connection using port 110.
    • The client identifies itself to the server during the connection establishment.
    • Client issues a series of POP3 commands to interact with the server.

Characteristics of Post Office Protocol (POP)

  • Pull Protocol: POP is a pull protocol, implying that the client initiates communication and pulls emails from the server when needed.
  • Transport Layer: POP utilizes TCP at the transport layer for reliable communication.
  • Port Number: POP uses port number 110 for communication between the client and the server.
  • Persistent TCP Connections: POP employs persistent TCP connections, allowing the client to maintain a continuous connection for multiple interactions with the server.
  • Connection-Oriented: POP is a connection-oriented protocol, ensuring a reliable and ordered data exchange between the client and the server.
  • In-Band Protocol: POP is an in-band protocol, meaning that control information and data share the same communication channel.
  • Stateful and Stateless: POP is stateful during a session while the mail is being downloaded, ensuring that the server maintains awareness of the client's actions. However, it becomes stateless across sessions.

Internet Message Access Protocol (IMAP)

Characteristics of IMAP

  • Pull Protocol: IMAP is a pull protocol, allowing clients to initiate communication and pull emails from the server when needed.
  • Transport Layer: IMAP uses TCP at the transport layer to ensure reliable communication between the client and the server.
  • Port Number: IMAP uses port number 143 for communication between the client and the server.
  • Persistent TCP Connections: IMAP employs persistent TCP connections, enabling clients to maintain continuous connections for multiple interactions with the server.
  • Connection-Oriented: IMAP is a connection-oriented protocol, ensuring a reliable and ordered data exchange between the client and the server.
  • In-Band Protocol: IMAP is an in-band protocol, meaning that control information and data share the same communication channel.
  • Stateful Protocol: IMAP is a stateful protocol, maintaining the state of the client's actions across the session for efficient interaction.
  • Distributed Mailboxes: IMAP distributes mailboxes across multiple servers, allowing for better organization and accessibility of emails.

POP vs. IMAP

Hyper Text Transfer Protocol (HTTP)

Purpose

Working

  • HTTP operates on a client-server model where:
    • The web browser acts as the client.
    • The client communicates with the web server hosting the website.
  • When a client requests information (such as clicking on a hyperlink) from the website server:
  • The browser sends a request message to the HTTP server for the requested objects. Then:
    • HTTP establishes a connection between the client and server through TCP.
    • HTTP sends a request to the server, which collects the requested data.
    • HTTP sends the response with the objects back to the client.
    • HTTP closes the connection.

HTTP Connections

  • Non-persistent: In non-persistent HTTP connections:
    • A new connection is established for each request and response exchange between the client and server.
    • After serving the requested content, the connection is immediately closed.
    • Subsequent requests require opening new connections, incurring additional overhead.
  • Persistent: In persistent HTTP connections:
    • A single connection is reused for multiple request-response exchanges between the client and server.
    • The connection remains open after serving a request, allowing for subsequent requests to use the same connection.
    • This reduces the overhead of opening and closing connections for each interaction.

HTTP Characteristics and Notes

  • HTTP uses TCP at the transport layer.
    • This choice is made because:
      • Unlike UDP, TCP ensures reliable data delivery through a Three-way handshake.
      • TCP guarantees retransmission of lost packets, providing a reliable communication channel.
      • HTTP lacks built-in reliability features, necessitating the use of TCP for reliable data transfer.
      • If HTTP used UDP, it would need to manage sessions independently, including packet retransmission.
  • It is important to note:
    • Any service not using TCP must have built-in reliability features.
  • HTTP uses port number 80.
    • HTTP clients use port 80 to send and receive requested web pages from an HTTP server.
    • HTTP servers respond to all requests at port 80.
  • HTTP 1.0 is non-persistent, and HTTP 1.1 is persistent.
    • Persistent connections, as in HTTP 1.1, improve performance by 20% compared to non-persistent connections.
  • HTTP 1.0 is a connectionless protocol:
    • After serving a single HTTP request, the connection is closed and not reused.
    • HTTP 1.0 without connection keep-alive is considered connectionless.
  • HTTP is an in-band protocol:
    • HTTP passes control data (commands) and main data over the same connection.
    • Both control data and main data are processed without distinction or priority for control data.
  • HTTP is a stateless protocol:
    • HTTP servers do not maintain any state information.
    • After sending a response, the server forgets about the client.
    • Each new request is treated independently, and the connection is automatically closed after generating the response.
  • If HTTP were a stateful protocol:
    • It would allow browser windows to engage connections with the web server for extended periods.
    • This could lead to a situation of reaching the maximum connections of a web server, even with many idle connections.

File Transfer Protocol (FTP)

Purpose:

  • FTP is designed for exchanging files over the internet.
  • It facilitates users in uploading and downloading files from the internet.

Working:

FTP establishes two TCP connections between the client and the server:

  1. One connection is dedicated to transferring data.
  2. The other connection is utilized for transferring control information.

Additional Information:

Characteristics of FTP

  • FTP uses TCP at the transport layer: FTP relies on the Transmission Control Protocol (TCP) for reliable communication between the client and server.
  • FTP uses port number 21 for the control connection: Port 21 is designated for the control connection, where commands and responses between the client and server are exchanged.
  • FTP uses port number 20 for the data connection: Port 20 is reserved for the data connection, facilitating the actual transfer of files between the client and server.
  • FTP establishes persistent TCP connections for the control connection: The control connection remains open throughout the FTP session, handling commands, and responses.
  • FTP uses non-persistent connections for the data connection: The data connection is established as needed for file transfers and closed after the transfer is complete.
  • FTP is a connection-oriented protocol: FTP maintains a connection between the client and server, ensuring a reliable exchange of commands and data.
  • FTP is an out-of-band protocol: FTP uses separate connections for control information (out-of-band) and data, enhancing efficiency and flexibility.
  • FTP is not mentioned as SMTP; it is a stateful protocol: FTP maintains the state of the session, remembering user login information and the current working directory.

Important Notes

  • Emails can't be sent using FTP.
    • FTP requires the establishment of a connection between the client and server before transferring files.
    • Both the client and server need to be online simultaneously for FTP file transfers.
    • Due to this requirement, emails are not sent using FTP.
  • FTP can transfer one file at a time.
    • FTP is designed for transferring a single file at a time in either direction between the client and server.
  • FTP is a stateful protocol.
    • The client establishes a control connection for the duration of an FTP session.
    • FTP sessions typically span multiple data transfers, making it a stateful protocol.