This document discusses a computer networks course taught by Dr. Shivashankar at RRIT. The course aims to help students understand networking concepts and protocols. It covers topics like network architectures, protocols at different layers, and basic network configurations. The document provides details of transport layer protocols like TCP and UDP, explaining their services, operation mechanisms, and applications.
Course Outcomes
After Completionof the course, student will be able to
Understand the concepts of networking thoroughly.
Describe the various network architectures
Identify the protocols and services of different layers
Distinguish the basic network configurations and
standards associated with each network models.
Analyze a simple network and measurements of its
parameters.
Text Book:
Data Communications and Networking , Forouzan, 5th
Edition, McGraw Hill, 2016 ISBN: 1-25-906475-3
2/11/2023 2
Dr. Shivashankar, E&CE, RRIT
3.
Module 4
TRANSPORT-LAYER PROTOCOLS
•The transport layer is a 4th layer from the top.
• The main role of the transport layer is to provide the
communication services directly to the application processes
running on different hosts.
• The transport layer provides a logical communication between
application processes running on different hosts.
• Although the application processes on different hosts are not
physically connected, application processes use the logical
communication provided by the transport layer to send the
messages to each other.
• The transport layer protocols are implemented in the end
systems, but not in the network routers.
2/11/2023 3
Dr. Shivashankar, E&CE, RRIT
4.
Transport-Layer Services
Process-to-Process Communication
•The first duty of a transport-layer protocol is to provide process-to-process
communication.
• A process is an application-layer entity (running program) that uses the
services of the transport layer.
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.
• A port number is a way to identify a specific process to which an internet or
other network message is to be forwarded when it arrives at a server.
• All network-connected devices come equipped with standardized ports that
have an assigned number.
• These numbers are reserved for certain protocols and their associated
function. Hypertext Transfer Protocol (HTTP) messages, for example, always
go to port 80.
2/11/2023 4
Dr. Shivashankar, E&CE, RRIT
5.
Flow Control:
• Flowcontrol is used to prevent the sender from overwhelming the receiver.
If the receiver is overloaded with too much data, then the receiver discards
the packets and asking for the retransmission of packets.
• This increases network congestion and thus, reducing the system
performance.
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.
Congestion Control:
• Congestion in a network may occur if the load on the network—the
number of packets sent to the network is greater than the capacity of the
network.
2/11/2023 5
Dr. Shivashankar, E&CE, RRIT
6.
Connectionless and Connection-OrientedProtocols
Connectionless Service
• The source process (application program) needs to divide its message into
chunks of data of the size acceptable by the transport layer and deliver them
to the transport layer one by one.
• The transport layer treats each chunk as a single unit without any relation
between the chunks. When a chunk arrives from the application layer, the
transport layer encapsulates it in a packet and sends it.
• To show the independency of packets, assume that a client process has three
chunks of messages to send to a server process.
2/11/2023 6
Dr. Shivashankar, E&CE, RRIT
Figure 23.14 Connectionless service
7.
Connectionless and Connection-OrientedProtocols
Connection-Oriented Service
• The client and the server first need to establish a logical connection between
themselves.
• The data exchange can only happen after the connection establishment.
• After data exchange, the connection needs to be torn down.
2/11/2023 7
Dr. Shivashankar, E&CE, RRIT
Figure 23.15 Connection-oriented service
8.
TRANSPORT-LAYER PROTOCOLS
Simple Protocol:
•The transport layer at the sender gets a message from its application layer, makes a
packet out of it, and sends the packet.
• The transport layer at the receiver receives a packet from its network layer, extracts
the message from the packet, and delivers the message to its application layer.
2/11/2023 8
Dr. Shivashankar, E&CE, RRIT
Figure 23.18 FSMs for the simple protocol
Figure 23.17 Simple protocol
9.
Stop-and-Wait Protocol
• Itis a connection-oriented protocol called the Stop-and-Wait protocol, which
uses both flow and error control.
• Both the sender and the receiver use a sliding window of size 1.
• The sender sends one packet at a time and waits for an acknowledgment
before sending the next one.
• To detect corrupted packets, we need to add a checksum to each data packet.
• When a packet arrives at the receiver site, it is checked.
• If its checksum is incorrect, the packet is corrupted and silently discarded.
2/11/2023 9
Dr. Shivashankar, E&CE, RRIT
Figure 23.20 Stop-and-Wait protocol
10.
Go-Back-N Protocol (GBN)
•To improve the efficiency of transmission (to fill the pipe), multiple packets
must be in transition while the sender is waiting for acknowledgment.
• The key to Go-back-N is that we can send several packets before receiving
acknowledgments, but the receiver can only buffer one packet.
• It keeps a copy of the sent packets until the acknowledgments arrive.
• Several data packets and acknowledgments can be in the channel at the same
time.
• In the Go-Back-N protocol, the acknowledgment number is cumulative and
defines the sequence number of the next packet expected to arrive.
2/11/2023 10
Dr. Shivashankar, E&CE, RRIT
Figure 23.23 Go-Back-N protocol
11.
Selective-Repeat Protocol
• TheGo-Back-N protocol is inefficient if the underlying network protocol loses a lot of
packets.
• Each time a single packet is lost or corrupted, the sender resends all outstanding
packets, even though some of these packets may have been received safe and sound
but out of order.
• The Selective-Repeat protocol also uses two windows: a send window and a receive
window.
• The receive window in Selective-Repeat is totally different from the one in Go- Back-N.
• The size of the receive window is the same as the size of the send window (maximum
2𝑚−1
).
Figure 23.32: Selective-Repeat protocol
2/11/2023 11
Dr. Shivashankar, E&CE, RRIT
12.
Transport-Layer Protocols inthe Internet
USER DATAGRAM PROTOCOL
• The User Datagram Protocol (UDP) is a connectionless, unreliable
transport protocol.
• It does not add anything to the services of IP except for providing process-
to-process communication instead of host-to-host communication.
• If UDP is so powerless, why would a process want to use it? With the
disadvantages come some advantages.
• UDP is a very simple protocol using a minimum of overhead.
• 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.
2/11/2023 Dr. Shivashankar, E&CE, RRIT 12
13.
User Datagram
• UDPpackets, called user datagrams, have a fixed-size header of 8 bytes
made of four fields, each of 2 bytes (16 bits).
• The first two fields define the source and destination port numbers.
• The third field defines the total length of the user datagram, header plus
data.
• The 16 bits can define a total length of 0 to 65,535 bytes.
• The last field can carry the option al checksum.
2/11/2023 Dr. Shivashankar, E&CE, RRIT 13
Figure 24.2 User datagram packet format
14.
UDP Services
Process-to-Process Communication
•UDP provides process-to-process communication using socket addresses, a
combination of IP addresses and port numbers.
Connectionless Services
• UDP provides a connectionless service.
• 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.
• The user datagrams are not numbered.
• This means that each user datagram can travel on a different path.
Flow Control
• UDP is a very simple protocol.
• There is no flow control, and hence no window mechanism.
• The receiver may overflow with incoming messages.
2/11/2023 14
Dr. Shivashankar, E&CE, RRIT
15.
Conti..
Error Control
• Thereis no error control mechanism in UDP except for the checksum.
• This means that the sender does not know if a message has been lost or duplicated.
• When the receiver detects an error through the checksum, the user datagram is
silently discarded.
• The lack of error control means that the process using UDP should provide for this
service, if needed.
Congestion Control
• Since UDP is a connectionless protocol, it does not provide congestion control.
Encapsulation and Decapsulation
• To send a message from one process to another, the UDP protocol encapsulates and
decapsulates messages.
Multiplexing and Demultiplexing
• In a host running a TCP/IP protocol suite, there is only one UDP but possibly several
processes that may want to use the services of UDP.
• To handle this situation, UDP multiplexes and demultiplexes.
2/11/2023 15
Dr. Shivashankar, E&CE, RRIT
16.
UDP Applications
• UDPis suitable for a process that requires simple request-
response communication with little concern for flow and error
control.
• UDP is suitable for a process with internal flow and error-control
mechanisms. For example, the Trivial File Transfer Protocol (TFTP)
process includes flow and error control. It can easily use UDP.
• UDP is a suitable transport protocol for multicasting.
• UDP is used for management processes such as SNMP.
• UDP is used for some route updating protocols such as Routing
Information Protocol (RIP).
• UDP is normally used for interactive real-time applications that
cannot tolerate uneven delay between sections of a received
message.
2/11/2023 16
Dr. Shivashankar, E&CE, RRIT
17.
Transmission Control Protocol(TCP)
• It is a connection-oriented, reliable protocol.
• TCP explicitly defines connection establishment, data transfer, and connection
teardown phases to provide a connection-oriented service.
• TCP uses a combination of GBN and SR protocols to provide reliability.
• 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
• TCP, unlike UDP, is a stream-oriented protocol.
• It 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.
2/11/2023 17
Dr. Shivashankar, E&CE, RRIT
18.
Full-Duplex Communication
•TCP offers full-duplex service, where data can flow in both directions at the
same time.
• Each TCP endpoint then has its own sending and receiving buffer, and
segments move in both directions.
Multiplexing and Demultiplexing
Like UDP, TCP performs multiplexing at the sender and demultiplexing at the
receiver. However, since TCP is a connection-oriented protocol, a connection
needs to be established for each pair of processes.
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.
2/11/2023 18
Dr. Shivashankar, E&CE, RRIT
19.
TCP Features
Numbering System
•Although the TCP software keeps track of the segments being transmitted or
received, there is no field for a segment number value in the segment header.
• Instead, there are two fields, called the sequence number and the
acknowledgment number.
• These two fields refer to a byte number and not a segment number.
Byte Number
• The bytes of data being transferred in each connection are numbered by TCP.
• TCP chooses an arbitrary number between 0 and 232
− 1 for the number of
the first byte.
Sequence Number
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.
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
previous segment.
2/11/2023 19
Dr. Shivashankar, E&CE, RRIT
20.
Segment
A packet inTCP is called a segment.
Format
• The segment consists of a header of 20 to 60 bytes, followed by data from the
application program.
• The header is 20 bytes if there are no options and up to 60 bytes if it contains
options.
2/11/2023 20
Dr. Shivashankar, E&CE, RRIT
21.
A TCP Connection
TCPis connection-oriented.
In TCP, connection-oriented transmission requires three phases:
• connection establishment
• data transfer
• connection termination.
Three-Way Handshaking
The connection establishment in TCP is called three-way handshaking (SYN-SYN-ACK)
2/11/2023 21
Dr. Shivashankar, E&CE, RRIT
Figure 24.10 Connection establishment using three-way handshaking
22.
State Transition Diagram
Tokeep track of all the different events happening during connection
establishment, connection termination, and data transfer, TCP is specified as the
finite state machine (FSM).
2/11/2023 22
Dr. Shivashankar, E&CE, RRIT
Figure 24.14 State transition diagram
23.
Windows in TCP
•Each window serves an important purpose for the flow of data between the
TCP sender and TCP receiver.
Send Window
The window size is 100 bytes.
• The send window in TCP is similar to the one used with the Selective-Repeat
protocol.
Receive Window
• The window size is 100 bytes.
• The receive window size determines the number of bytes that the receive
window can accept from the sender before being overwhelmed (flow control).
2/11/2023 23
Dr. Shivashankar, E&CE, RRIT
24.
Flow Control
TCP separatesflow control from error control.
2/11/2023 24
Dr. Shivashankar, E&CE, RRIT
Figure 24.19 Data flow and flow control feedbacks in TCP
25.
Error Control
• TCPis a reliable transport-layer protocol.
• An application program that delivers a stream of data to TCP relies on TCP to
deliver the entire stream to the application program on the other end in
order, without error, and without any part lost or duplicated.
• TCP provides reliability using error control.
• Error control includes mechanisms for detecting and resending corrupted
segments, resending lost segments, storing out-of-order segments until
missing segments arrive, and detecting and discarding duplicated segments.
• Error control in TCP is achieved through the use of three simple tools:
checksum,
acknowledgment, and
time-out.
2/11/2023 25
Dr. Shivashankar, E&CE, RRIT
26.
Checksum
• Each segmentincludes a checksum field, used to check for a corrupted segment.
• If a segment is corrupted, as detected by an invalid checksum, the segment is dis-
carded by the destination TCP and is considered as lost.
• TCP uses a 16-bit checksum that is mandatory in every segment.
Acknowledgment
• TCP uses acknowledgments to confirm the receipt of data segments.
• Control segments that carry no data, but consume a sequence number, are also
acknowledged.
• ACK segments are never acknowledged.
Acknowledgment Type
Cumulative Acknowledgment (ACK):
• The 32-bit ACK field in the TCP header is used for cumulative acknowledgments, and its
value is valid only when the ACK flag bit is set to 1.
Selective Acknowledgment (SACK):
• A SACK does not replace an ACK, but reports additional information to the sender.
• A SACK reports a block of bytes that is out of order, and also a block of bytes that is
duplicated, i.e., received more than once.
2/11/2023 26
Dr. Shivashankar, E&CE, RRIT
27.
TCP Congestion Control
CongestionWindow
• To control the number of segments to transmit, TCP uses another variable
called a congestion window, cwnd.
• The receiver window, rwnd variable together define the size of the send
window in TCP.
• The first is related to the congestion in the middle (network); the second is
related to the congestion at the end.
• Actual window size 5 minimum (rwnd, cwnd )
Congestion Detection
• TCP sender uses only one feedback from the other end to detect congestion:
ACKs.
• The lack of regular, timely receipt of ACKs, which results in a time-out, is the
sign of a strong congestion; the receiving of three duplicate ACKs is the sign of
a weak congestion in the network.
2/11/2023 27
Dr. Shivashankar, E&CE, RRIT