The document provides an overview of the transport layer in networking, detailing its role in process-to-process communication, the use of port numbers for addressing, and the differences between connectionless (UDP) and connection-oriented (TCP) protocols. It explains the functionalities of UDP and TCP, including error control, flow control, and the establishment of connections. Additionally, it discusses congestion control mechanisms, differentiating between open-loop and closed-loop strategies.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
3 views86 pages
CN m6c
The document provides an overview of the transport layer in networking, detailing its role in process-to-process communication, the use of port numbers for addressing, and the differences between connectionless (UDP) and connection-oriented (TCP) protocols. It explains the functionalities of UDP and TCP, including error control, flow control, and the establishment of connections. Additionally, it discusses congestion control mechanisms, differentiating between open-loop and closed-loop strategies.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 86
Module 6
Introduction to Transport Layer
Transport-Layer Services • Transport layer is located between the network layer and the application layer. • The transport layer is responsible for providing services to the application layer; it receives services from the network layer Process-to-Process Communication
• The transport layer is responsible for process-
to-process delivery—the delivery of a packet, part of a message, from one process to another. • Two processes communicate in a client/server relationship. Types of data deliveries Addressing: Port Numbers • A process on the local host, called a client, needs services from a process usually on the remote host, called a server. • However, operating systems today support both multiuser and multiprogramming environments. • A remote computer can run several server programs at the same time, just as several local computers can run one or more client programs at the same time. • For communication, we must define the local host, local process, remote host, and remote process. • The local host and the remote host are defined using IP addresses. • To define the processes, we need second identifiers, called port numbers. In the TCP/IP protocol suite, the port numbers are integers between 0 and 65,535 (1M6itulbPaittels). Addressing: Port Numbers • The client program defines itself with a port number, called the ephemeral port number. • The word ephemeral means “short-lived” and is used because the life of a client is normally short. • TCP/IP has decided to use universal port numbers for servers; these are called well- known port numbers Port numbers IP addresses versus port numbers ICANN Ranges Socket Address • A transport-layer protocol in the TCP suite needs both the IP address and the port number, at each end, to make a connection. The combination of an IP address and a port number is called a socket address. • The client socket address defines the client process uniquely just as the server socket address defines the server process uniquely. Encapsulation and Decapsulation Multiplexing and Demultiplexing • Whenever an entity accepts items from more than one source, this is referred to as multiplexing (many to one); whenever an entity delivers items to more than one source, this is referred to as demultiplexing (one to many). • The transport layer at the source performs multiplexing; the transport layer at the destination performs demultiplexing Multiplexing and Demultiplexing Flow Control at Transport Layer Buffers • Although flow control can be implemented in several ways, one of the solutions is normally to use two buffers: one at the sending transport layer and the other at the receiving transport layer. • A buffer is a set of memory locations that can hold packets at the sender and receiver. • The flow control communication can occur by sending signals from the consumer to the producer. Error Control • Error control at the transport layer is responsible for 1. Detecting and discarding corrupted packets. 2. Keeping track of lost and discarded packets and resending them. 3. Recognizing duplicate packets and discarding them. 4. Buffering out-of-order packets until the missing packets arrive. Sequence Numbers • Error control requires that the sending transport layer knows which packet is to be resent and the receiving transport layer knows which packet is a duplicate, or which packet has arrived out of order. • This can be done if the packets are numbered. We can add a field to the transport-layer packet to hold the sequence number of the packet. Sequence Numbers • However, because we need to include the sequence number of each packet in the header, we need to set a limit. If the header of the packet allows m bits for the sequence number, the sequence numbers range from 0 to 2m − 1. • If m is 4, the only sequence numbers are 0 through 15, inclusive. However, we can wrap around the sequence. So the sequence numbers in this case are Sliding Window Connectionless and Connection- Oriented Protocols • A transport-layer protocol, like a network- layer protocol, can provide two types of services: connectionless and connection- oriented • Connectionless service at the transport layer means independency between packets; connection-oriented means dependency. Connectionless Service Connectionless Service • We can say that no flow control, error control, or congestion control can be effectively implemented in a connectionless service. Connection-Oriented Service Connection-oriented service • We can implement flow control, error control, and congestion control in a connection oriented protocol. Transport-Layer Protocols Services • UDP • UDP is an unreliable connectionless transport-layer protocol used for its simplicity and efficiency in applications where error control can be provided by the application-layer process. • TCP • TCP is a reliable connection-oriented protocol that can be used in any application where reliability is important. • SCTP • SCTP is a new transport-layer protocol that combines the features of UDP and T C P Port Numbers
Mitul Patel SECE3011-
Computer Networks B.Tech-Sem5 USER DATAGRAM PROTOCOL(UDP)
• connectionless, unreliable transport protocol.
• providing process-to-process communication instead of host-to-host communication • If UDP is so powerless, why would a process want to use it? • “If a process wants to send a small message and does not care much about reliability, it can use UDP. Sending a small message using UDP takes much less interaction between the sender and receiver than using TCP” User datagram packet format Example Solution Exercise UDP Services 1. Process-to-Process Communication – using socket addresses, a combination of IP addresses and port numbers. 2. Connectionless Services – Each user datagram sent by UDP is an independent datagram. – There is no relationship between the different user datagrams even if they are coming from the same source process and going to the same destination program. – no connection establishment and no connection termination UDP Services 3. Flow Control – no flow control. the process using UDP should provide for this service, if needed 4. Error Control – no error control. the process using UDP should provide for this service, if needed 5. Checksum – UDP checksum calculation includes three sections: a pseudoheader, the UDP header, and the data coming from the application layer. The pseudoheader is the part of the header of the IP packet. Pseudoheader for checksum calculation UDP Services 6. Congestion Control – does not provide congestion control. 7. Encapsulation and Decapsulation 8. Multiplexing and Demultiplexing UDP Applications • The connectionless service provides less delay; the connection-oriented service creates more delay. If delay is an important issue for the application, the connectionless service is preferred. • A client-server application such as DNS uses the services of UDP because a client needs to send a short request to a server and to receive a quick response from it. UDP Applications • A client-server application such as SMTP, which is used in electronic mail, cannot use the services of UDP because a user might send a long e-mail message, which could include multimedia (images, audio, or video). Examples 1. Downloading a very large text file from the Internet? – can’t use UDP 2. Real-time interactive application, such as Skype? – can use UDP 3. route updating protocols such as Routing Information Protocol(RIP) – can use UDP TRANSMISSION CONTROL PROTOCOL(TCP)
• connection-oriented, reliable protocol.
• TCP explicitly defines connection establishment, data transfer, and connection teardown phases to provide a connection-oriented service. • To achieve this goal, TCP uses checksum (for error detection), retransmission of lost or corrupted packets, cumulative and selective acknowledgments, and timers. TCP Services • Process-to-Process Communication – As with UDP, TCP provides process-to-process communication using port numbers • Stream Delivery Service – allows the sending process to deliver data as a stream of bytes and allows the receiving process to obtain data as a stream of bytes • Sending and Receiving Buffers – Because the sending and the receiving processes may not necessarily write or read data at the same rate, TCP needs buffers for storage. There are two buffers, the sending buffer and the receiving buffer, one for each direction. – One way to implement a buffer is to use a circular array of 1-byte locations as shown in Figure Sending and receiving buffers TCP Segment • At the transport layer, TCP groups a number of bytes together into a packet called a segment. • TCP adds a header to each segment (for control purposes) and delivers the segment to the network layer for transmission. • The segments are encapsulated in an IP datagram and transmitted. TCP segments • Connection-Oriented Service – TCP, unlike UDP, is a connection-oriented protocol. When a process at site A wants to send to and receive data from another process at site B, the following three phases occur: 1. The two TCP’s establish a logical connection between them. 2. Data are exchanged in both directions. 3. The connection is terminated. • Full-Duplex Communication – TCP offers full-duplex service, where data can flow in both directions at the same time. • Multiplexing and Demultiplexing – Like UDP, TCP performs multiplexing at the sender and demultiplexing at the receiver. • Reliable Service – TCP is a reliable transport protocol. It uses an acknowledgment mechanism to check the safe and sound arrival of data. Numbering System • Sequence Number • After the bytes have been numbered, TCP assigns a sequence number to each segment that is being sent. The sequence number, in each direction, is defined as follows: 1. The sequence number of the first segment is the ISN (initial sequence number),which is a random number between 0 and 232 − 1. 2. The sequence number of any other segment is the sequence number of the previous segment plus the number of bytes (real or imaginary) carried by the Mitul Patel SECE3011- previous segment. Computer Networks B.Tech-Sem5 Example • Suppose a TCP connection is transferring a file of 5000 bytes. The first byte is numbered 10001. • What are the sequence numbers for each segment if data are sent in five segments, each carrying 1000 bytes? Example
The following shows the sequence number for each
segment: Note
The bytes of data being transferred in each
connection are numbered by TCP. The numbering starts with a randomly generated number. Acknowledgment Number • The sequence number in each direction shows the number of the first byte carried by the segment. • Each party also uses an acknowledgment number to confirm the bytes it has received. • However, the acknowledgment number defines the number of the next byte that the party expects to receive. TCP segment format Note
The value in the sequence number field of a
segment defines the number of the first data byte contained in that segment. Note
The value of the acknowledgment field in a segment
defines the number of the next byte a party expects to receive. Control field Description of flags in the control field Urgent pointer • This 16-bit field, which is valid only if the urgent flag is set, is used when the segment contains urgent data. • It defines a value that must be added to the sequence number to obtain the number of the last urgent byte in the data section of the segment. A TCP Connection • In TCP, connection-oriented transmission requires three phases: – connection establishment – data transfer, and – connection termination. Connection Establishment • The connection establishment in TCP is called three-way handshaking. In our example, an application program, called the client, wants to make a connection with another application program, called the server, using TCP as the transport-layer protocol. Connection establishment using three-way handshaking Note
A SYN segment cannot carry data, but it
consumes one sequence number. Note
A SYN + ACK segment cannot
carry data, but does consume one sequence number. Note
An ACK segment, if carrying no data,
consumes no sequence number. Data Transfer
Mitul Patel SECE3011-
Computer Networks B.Tech-Sem5 Connection termination using three-way handshaking Note
The FIN segment consumes one sequence
number if it does not carry data. Note
The FIN + ACK segment consumes
one sequence number if it does not carry data. Half-Close • In TCP, one end can stop sending data while still receiving data. This is called a halfclose • It can occur when the server needs all the data before processing can begin. A good example is sorting. • The client sends data to the server to be sorted, the server needs to receive all the data before sorting can start. This means the client, after sending all data, can close the connection in the client-to-server direction. • However, the server-to-client direction must remain open to return the sorted data. The server, after receiving the data, still needs time for sorting; its outbound direction must remain open Half-close Summary • UDP is an unreliable and connectionless transport-layer protocol that creates a process to process communication, which means it requires little overhead and offers fast delivery. • The UDP packet is called a user datagram. • UDP has no flow- or error-control mechanism; its only attempt at error control is the checksum Summary • Transmission Control Protocol (TCP) is another transport-layer protocol in the TCP/IP protocol suite. • It provides process-to-process, full-duplex, and connection oriented service. • A TCP connection consists of three phases: connection establishment, data transfer, and connection termination. Exercise Congestion Control Congestion Control Mechanisms
•Types:
•Open-loop Control: Prevents congestion before it occurs.
•Closed-loop Control: Detects and resolves congestion when it occurs. Open-Loop Congestion Control
• Open-loop control mechanisms work by designing the
system in a way that minimizes the chances of congestion occurring. These mechanisms do not rely on feedback from the network but instead use pre- defined policies to regulate traffic. • Common Open-Loop Congestion Control Techniques: • Traffic Shaping: Limits the rate at which data is transmitted (e.g., Leaky Bucket and Token Bucket algorithms). • Admission Control: Determines whether a new connection request should be accepted based on current network capacity. Open-Loop Congestion Control
Resource Reservation: Allocates bandwidth and
buffer resources before data transmission begins.
Packet Discarding: Prevents excessive packet
buildup by discarding low-priority packets when congestion is likely. Closed-Loop Congestion Control
• Closed-loop congestion control is a method used
in network systems to detect congestion when it occurs and take corrective actions to mitigate its effects. • Unlike open-loop control, which focuses on prevention, closed-loop control monitors the system in real-time and dynamically adjusts network behavior to resolve congestion. Key Steps in Closed-Loop Congestion Control Congestion Detection: The system monitors network performance using metrics like packet loss, queue length, or delay. Feedback Mechanism: Once congestion is detected, feedback is sent to the sender or network nodes to take corrective actions. Congestion Resolution: The system applies control techniques to reduce congestion, such as reducing transmission rates or rerouting traffic. Closed-Loop Congestion Control Techniques ▪ Backpressure: A technique used in virtual circuit networks where a congested node signals upstream nodes to slow down data transmission. ▪ Choke Packets: Special control packets sent by a congested router to notify the sender to reduce the transmission rate. • Explicit Congestion Notification (ECN): A mechanism where routers mark packets instead of dropping them to indicate congestion. ▪ TCP Congestion Control: Uses algorithms like AIMD (Additive Increase Multiplicative Decrease), Slow Start, Congestion Avoidance, and Fast Recovery to adjust the sender’s transmission rate. Quality of Service (QoS) ▪ Quality of Service (QoS) refers to the ability of a network to prioritize, manage, and optimize traffic flow to meet performance requirements for different applications. It ensures that latency, bandwidth, packet loss, and jitter are controlled to provide a better user experience, especially for real-time applications like video calls, VoIP, and online gaming. Quality of Service (QoS) ▪ Key QoS Parameters in the Transport Layer
The transport layer plays a crucial role in ensuring
QoS by managing end-to-end communication. The key performance metrics include: Bandwidth – The maximum data rate a network connection can support. Latency (Delay) – The time taken for a packet to travel from source to destination. Jitter – Variation in packet delay, which affects real- time applications. Packet Loss – The percentage of packets lost during transmission, impacting data integrity. Reliability – Ensuring data is delivered accurately and in sequence. Quality of Service (QoS) ▪ How to Improve QoS at the Transport Layer?
1. Traffic Prioritization
Some transport protocols prioritize critical data
packets (e.g., VoIP packets over normal web traffic). Solution: Use Differentiated Services (DiffServ) and Integrated Services (IntServ) models to classify and manage traffic priority.
2. Congestion Control Mechanisms
TCP Congestion Control: Helps manage network
congestion using Slow Start, Congestion Avoidance, and Fast Recovery algorithms. Quality of Service (QoS) ▪ How to Improve QoS at the Transport Layer?
3. Explicit Congestion Notification (ECN): Allows
routers to inform senders about congestion without dropping packets.
4. Bandwidth Management & Traffic Shaping
• Leaky Bucket Algorithm: Controls data
transmission rate to avoid congestion. • Token Bucket Algorithm: Ensures fair bandwidth distribution and allows bursty traffic when necessary. Quality of Service (QoS) ▪ How to Improve QoS at the Transport Layer?
5. Transport Layer Protocol Selection
• TCP (Transmission Control Protocol) provides
reliable delivery and congestion control but may introduce delay.
• UDP (User Datagram Protocol) is faster but lacks
reliability. Used for real-time applications where speed is critical.
• QUIC (Quick UDP Internet Connections)
enhances QoS by combining UDP’s speed with TCP-like reliability while reducing latency. THANK YOU