Unit - 4
Unit - 4
Transport layer
Process to Process Communication
User Datagram Protocol (UDP)
Transmission Control Protocol (TCP)
SCTP
Congestion Control
Quality of Service
QoS improving techniques:
Leaky Bucket and Token Bucket algorithm
Transport Layer
• The transport Layer is the second layer in the TCP/IP model and
the fourth layer in the OSI model.
• It is an end-to-end layer used to deliver messages to a host. It is
termed an end-to-end layer because it provides a point-to-point
connection rather than hop-to-hop, between the source host and
destination host to deliver the services reliably.
• The unit of data encapsulation in the Transport Layer is a
segment.
Transport Layer working:
The transport layer takes services from the Application layer and
provides services to the Network layer
• At the sender’s side: The transport layer receives data
(message) from the Application layer and then performs
Segmentation, divides the actual message into segments, adds
the source and destination’s port numbers into the header of
the segment, and transfers the message to the Network layer.
• At the receiver’s side: The transport layer receives data from
the Network layer, reassembles the segmented data, reads its
header, identifies the port number, and forwards the message to
the appropriate port in the Application layer.
PROCESS-TO-PROCESS COMMUNICATION/DELIVERY
23.4
oThe Data link layer is responsible for delivery of frames between nodes
over a link node to node delivery using a MAC address to choose one node
among several.
23.6
Client/Server Paradigm
A process on the local host, called a client, needs services from a process
usually on the remote host, called a server.
• Both processes (client and server) have the same name.
• For example, to get the day and time from a remote machine,
we need a Daytime client process running on the local host and a
Daytime server process running on a remote machine.
PORT NUMBER:-
oIn the Internet model, the port numbers are 16-bit integers between 0 and 65,535.
oThe client program defines itself with a port number,
chosen randomly by the transport layer software running on the client host
oThe server process must also define itself with a port number This port
number, however, cannot be chosen randomly
oThe Internet uses port numbers for servers called well-
known port numbers.
oEvery client process knows the well-known port number of
the corresponding server process
Figure 23.2 Example Port numbers
For example, while the Daytime client process, can use an ephemeral (temporary) port
number 52,000 to identify itself, the Daytime server process must use the well-known
(permanent) port number 13.
23.8
IANA ranges
23.9
IP ADDRESSES VERSUS PORT NUMBERS:-
IP addresses and port numbers play different roles in selecting the
destination of data.
final
The destination IP address defines the host among the different hosts
After the host has been selected, the port number defines one of the processes
on this particular host
SOCKET ADDRESSES
o Process-to-process delivery needs two identifiers, IP address and the port
number, at each end to make a connection.
oThe combination of an IP address and a port number is called a socket
address.
oA transport layer protocol needs a pair of socket addresses: the client socket
address and the server socket address.
oThese four pieces of information are part of the IP header and the
transport layer protocol header.
• The IP header contains the IP addresses; the UDP or TCP header
contains the port numbers.
Multiplexing and demultiplexing
Sender: multiplexing of UDP datagrams.UDP datagrams are received
from multiple application programs. A single sequence of UDP datagrams is
passed to IP layer.
Receiver: demultiplexing of UDP datagrams.Single sequence of UDP
datagrams received from IP layer. UDP datagram received is passed to
appropriate application.
CONNECTIONLESS VERSUS CONNECTION-ORIENTED SERVICE:
23.15
Transport layers protocols
Figure 23.8 Position of UDP, TCP, and SCTP in TCP/IP
suite
23.17
23-2 USERDATAGRAM PROTOCOL(UDP)
23.19
User datagram format:-
23.20
User Datagram:-
The UDP header consists of four fields each of 2
bytes in length:
Source Port (UDP packets from a client use this as a
service access point (SAP) to indicate the session
on the local client that originated the packet. UDP
packets from a server carry the server SAP in this
field)
Destination Port (UDP packets from a client use this
as a service access point (SAP) to indicate the
service required from the remote server. UDP
packets from a server carry the client SAP in this
field)
UDP length (The number of bytes comprising the
combined UDP
header information and payload data)
UDP Checksum (A checksum to verify that the end
to end data has not been corrupted by routers or
Note
UDP length
= IP length – IP header’s
length
23.22
UDP Checksum
23.23
Queues in UDP
23.24
UDP Characteristics:-
23.28
TCP Services:-
•Stream Delivery Service.
•Sending and Receiving Buffers.
•Bytes and Segments.
•Full Duplex Service.
•Connection Oriented Service.
•Reliable Service.
23.33
The segment consists of a 20-60-
byte header.
Source port address:
This is a 16-bit field , it defines the port number of the application
program in the host that is sending the segment.
Destination port address:
This is a 16-bit field, it defines the port number of the application
program in the host that is receiving the segment.
Sequence number: This 32-bit field defines the number assigned
to the first byte of data contained in this segment.
Acknowledgment number: This 32 bit field defines the number of
the next byte a party expects to receive.
Header length: A 4-bit field that indicates the number of 4-byte
words in the TCP header. The length of the header can be
between 20 and 60 bytes. Therefore, the value of this field can be
between 5 (5 x 4 =20) and 15 (15 x 4 =60).
Reserved. This is a 6-bit field reserved for future use.
23.36
Window size: Defines the size of the window, in bytes, that
the other party must maintain. the length of this field is 16
bits, which means that the maximum size of the window is
65,535 bytes. This value is normally referred to as the
receiving window (rwnd) and is determined by the receiver.
The sender must obey the dictation of the receiver in this
case.
1.connection establishment
TCP transmits data in full-duplex mode.
🢝 When two TCPs in two machines are connected, they are able to send segments
to each other simultaneously.
Each party must initialize communication and get approval from the other party
before any data are transferred.
The connection establishment in TCP is called three way handshaking.
Three way handshaking:-
1.The client sends the first segment, a SYN segment, in which only the SYN flag is set.
🢝 This segment is for synchronization of sequence numbers. It consumes one sequence
number.
🢝 When the data transfer starts, the sequence number is incremented by 1.
🢝 The SYN segment carries no real data
2. The server sends the second segment, a SYN +ACK segment, with 2
flag bits set: SYN and ACK.
🢝 This segment has a dual purpose. It is a SYN segment for communication in the other
direction and serves as the acknowledgment for the SYN segment.
🢝 It consumes one sequence number.
3.The client sends the third segment. This is just an ACK segment.
🢝 It acknowledges the receipt of the second segment with the ACK flag
🢝 The sequence number in this segment is the same as the one in the SYN segment.
🢝 The ACK segment does not consume any sequence numbers.
Figure 23.18 Connection establishment using three-way
handshaking
23.40
2.Data Transfer:-
• After connection is established,
bidirectional data transfer can take
place
• The client and server can both send
data and acknowledgments
• The acknowledgment is piggybacked
with the data.
23.41
3.connection termination:-
1. The client TCP, after receiving a close command from the client process, sends the
first segment, a FIN segment in which the FIN flag is set.
2.The server TCP, after receiving the FIN segment, sends the second segment, a FIN
+ACK segment, to confirm the receipt of the FIN segment from the client and at the
same time to announce the closing of the connection in the other direction.
3. The client TCP sends the last segment, an ACK segment, to confirm the receipt of
the FIN segment from the TCP server.
Half-close
Flow Control
TCP uses a sliding window to handle flow control. TCP sliding window
is of variable size.The window is opened, closed, or shrunk.
• 🢝 Opening a window means moving the right wall to the right.
• 🢝 Closing the window means moving the left wall to the right.
• 🢝 Shrinking the window means moving the right wall to the left.
The size of the window at one end is determined by the lesser of two values: receiver window
(rwnd) or congestion window (cwnd).
Some points about TCP sliding windows:
❏ The size of the window is the lesser of rwnd and cwnd.
❏ The source does not have to send a full window’s worth of data.
❏ The window can be opened or closed by the receiver, but should not be
shrunk.
❏ The destination can send an acknowledgment at any time as long as it does not
result in a shrinking window.
❏ The receiver can temporarily shut down the window; the sender, however, can
always send a segment of 1 byte after the window is shut down.
23.50
Note
23.51
Table 23.4 Some SCTP applications
23.52
SCTP services:-
The services provided by the SCTP are as follows −
•Process-to-Process Communication − SCTP uses all ports
in the TCP space.
•Multiple Streams − SCTP allows multi stream service in
every connection, which is called association in SCTP
terminology. If any one of the streams is blocked, then the other
streams can deliver their data.
•Multihoming − The sending and receiving host can define multiple
IP addresses in each end for an association. In this approach when
one path fails, another interface is ready to deliver without
interruption. This fault-tolerant is used when we are sending and
receiving real-time payload like Internet telephony.
23.56
Note
23.57
Figure 23.30 Packet, data chunks, and
streams
23.58
Table 23.5
Chunks
23.59
A connection in SCTP is called an association.
Association Establisment:-
Association termination
Congestion Control and
Quality of Service
24-1 DATATRAFFIC
The main focus of congestion control and quality of
service is data traffic. In congestion control we try to
avoid traffic congestion. In quality of service, we try to
create an appropriate environment for the traffic. So,
before talking about congestion control and quality of
service, we discuss the data traffic itself.
24.2
Figure 24.1 Traffic
descriptors
24.3
Figure 24.2 Three traffic
profiles
24.4
CONGESTION
24.5
Congestion: the load on the network is greater than the capacity of the network
Congestion control: the mechanisms to control the congestion and keep the
load below the capacity
Congestion occurs because routers and switches have queues- buffers that hold
the packets before and after processing
The rate of packet arrival > packet processing time 🡪 input queue longer
The packet departure time < packet processing time 🡪 output queue longer
CONGESTIONCONTROL
24.9
Open loop:-
Closed-loop:-
Closed-loop congestion control mechanisms try to alleviate
congestion after it happens. Several mechanisms have
been used by different protocols.
24.23
Figure 24.15 Flow
characteristics
24.24
TECHNIQUESTOIMPROVE QoS
24.25
Figure 24.16 FIFO
queue
24.26
Figure 24.17 Priority
queuing
24.27
Figure 24.18 Weighted fair
queuing
24.28
LEAKY BUCKET:-
Leaky bucket implementation
Token bucket
Token bucket