0% found this document useful (0 votes)
16 views59 pages

Udp-Tcp

The document discusses the transport layer's role in process-to-process delivery, focusing on protocols like UDP and TCP. It explains the client/server paradigm, the significance of port numbers, and the differences between connectionless and connection-oriented services. Additionally, it covers reliability in transport protocols, detailing how UDP is connectionless and unreliable, while TCP is connection-oriented and reliable, including its flow and error control mechanisms.

Uploaded by

devanbansal777
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views59 pages

Udp-Tcp

The document discusses the transport layer's role in process-to-process delivery, focusing on protocols like UDP and TCP. It explains the client/server paradigm, the significance of port numbers, and the differences between connectionless and connection-oriented services. Additionally, it covers reliability in transport protocols, detailing how UDP is connectionless and unreliable, while TCP is connection-oriented and reliable, including its flow and error control mechanisms.

Uploaded by

devanbansal777
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 59

Process-to-Process Delivery:

UDP, TCP

Dr. Mohit Kumar


Dept. of IT
NIT Jalandhar
23-1 PROCESS-TO-PROCESS DELIVERY

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, as we will
see later.
Topics discussed in this section:
Client/Server Paradigm
Multiplexing and Demultiplexing
Connectionless Versus Connection-Oriented Service
Reliable Versus Unreliable
Three Protocols
Note

The transport layer is responsible for


process-to-process delivery.
Figure 23.1 Types of data deliveries
Client/Server Paradigm
 A process on local host is called a client, needs services from a
process usually on the remote host called a server.
 We need a transport layer address, called a port number to
choose among multiple processes running on destination host.
 The destination port number is needed for delivery and source
port number is needed for the reply.
 The program defines itself with a port number, chosen
randomly by the transport layer software running on client
host, is ephemeral port number.
 The server process must also define itself with a port number.
However can not be chosen randomly.

23.5
Figure 23.2 Port numbers
Figure 23.3 IP addresses versus port numbers
Figure 23.4 IANA (Internet assigned number Authority) ranges
 Well-known ports: The ports ranging from 0 to 1023 are
assigned and controlled by lANA. These are the well-known
ports.
 Registered ports: The ports ranging from 1024 to 49,151 are
not assigned or controlled by lANA. They can only be
registered with lANA to prevent duplication.
 Dynamic ports: The ports ranging from 49,152 to 65,535 are
neither controlled nor registered. They can be used by any
process. These are the ephemeral ports.
Figure 23.5 Socket address

 Process to process delivery required two identifiers, IP address


and port number at each end to make connection.
 The combination of IP address and port address is called
socket address.
Figure 23.6 Multiplexing and demultiplexing
Connectionless Service vs Connection-Oriented
Service

 Connectionless Service:
 In a connectionless service, the packets are sent from one party to another with
no need for connection establishment or connection release.
 The packets are not numbered; they may be delayed or lost or may arrive out
of sequence.
 There is no acknowledgment either.
 UDP, is connectionless.
 Connection-Oriented Service:
 In a connection-oriented service, a connection is first established between the
sender and the receiver.
 Data are transferred.
 At the end, the connection is released.
 TCP and SCTP are connection-oriented protocols
Reliable Versus Unreliable
 The transport layer service can be reliable or unreliable.
 If the application layer program needs reliability, we use a reliable
transport layer protocol by implementing flow and error control at the
transport layer.
 This means a slower and more complex service.
 On the other hand, if the application program does not need reliability
because it uses its own flow and error control mechanism or it needs fast
service or the nature of the service does not demand flow and error control
(real-time applications), then an unreliable protocol can be used.
 In the Internet, there are three common different transport layer protocols,
as we have already mentioned.
 UDP is connectionless and unreliable;
 TCP and SCTP are connection-oriented and reliable.
Figure 23.7 Error control
Figure 23.8 Position of UDP, TCP, and SCTP in TCP/IP suite
23-2 USER DATAGRAM PROTOCOL (UDP)

The User Datagram Protocol (UDP) is called a


connectionless, unreliable transport protocol. It does
not add anything to the services of IP except to provide
process-to-process communication instead of host-to-
host communication.
Topics discussed in this section:
Well-Known Ports for UDP
User Datagram
Checksum
UDP Operation
Use of UDP
Table 23.1 Well-known ports used with UDP
Figure 23.9 User datagram format
Note

UDP length
= IP length – IP header’s length
Figure 23.10 Pseudoheader for checksum calculation
Figure 23.12 Queues in UDP
23-3 TCP

TCP is a connection-oriented protocol; it creates a


virtual connection between two TCPs to send data. In
addition, TCP uses flow and error control mechanisms
at the transport level.

Topics discussed in this section:


TCP Services
TCP Features
Segment
A TCP Connection
Flow Control
Error Control
Table 23.2 Well-known ports used by TCP
Figure 23.13 Stream delivery
Note

The bytes of data being transferred in


each connection are numbered by TCP.
The numbering starts with a randomly
generated number.
Example 23.3

The following shows the sequence number for each


segment:
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.
The acknowledgment number is
cumulative.
Figure 23.16 TCP segment format
Figure 23.17 Control field
Table 23.3 Description of flags in the control field
Figure 23.18 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.
Figure 23.19 Data transfer
Figure 23.20 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.
Figure 23.21 Half-close
Figure 23.22 Sliding window
Note

A sliding window is used to make


transmission more efficient as well as
to control the flow of data so that the
destination does not become
overwhelmed with data.
TCP sliding windows are byte-oriented.
Example 23.4

What is the value of the receiver window (rwnd) for host


A if the receiver, host B, has a buffer size of 5000 bytes
and 1000 bytes of received and unprocessed data?

Solution
The value of rwnd = 5000 − 1000 = 4000. Host B can
receive only 4000 bytes of data before overflowing its
buffer. Host B advertises this value in its next segment to
A.
Example 23.5

What is the size of the window for host A if the value of


rwnd is 3000 bytes and the value of cwnd is 3500 bytes?

Solution
The size of the window is the smaller of rwnd and cwnd,
which is 3000 bytes.
Example 23.6

Figure 23.23 shows an unrealistic example of a sliding


window. The sender has sent bytes up to 202. We assume
that cwnd is 20 (in reality this value is thousands of
bytes). The receiver has sent an acknowledgment number
of 200 with an rwnd of 9 bytes (in reality this value is
thousands of bytes). The size of the sender window is the
minimum of rwnd and cwnd, or 9 bytes. Bytes 200 to 202
are sent, but not acknowledged. Bytes 203 to 208 can be
sent without worrying about acknowledgment. Bytes 209
and above cannot be sent.
Figure 23.23 Example 23.6
Note

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.
Note

In modern implementations, a
retransmission occurs if the
retransmission timer expires or three
duplicate ACK segments have arrived.
Note

Data may arrive out of order and be


temporarily stored by the receiving TCP,
but TCP guarantees that no out-of-order
segment is delivered to the process.
Note

The receiver TCP delivers only ordered


data to the process.
CONGESTION CONTROL

 Congestion control in TCP is based on both open loop and closed-loop

mechanisms.

 TCP uses a congestion window and a congestion policy that avoid congestion

and detect and alleviate congestion after it has occurred.

 Congestion Window
51  Congestion Policy
TCP Congestion Control
 Slow Start: Exponential Increase
 Congestion Avoidance: Additive
Increase
 Congestion Detection: Multiplicative
Decrease
Figure 34 Slow start, exponential increase

1
cwnd
RTT
2
cwnd

RTT
4
cwnd

RTT
8

cwnd
Note

In the slow start algorithm, the size of the congestion window

increases exponentially until it reaches a threshold.


Figure 35 Congestion avoidance, additive increase
Note

In the congestion avoidance algorithm the size of the congestion

window

increases additively until

congestion is detected.
Congestion Detection:
Multiplicative Decrease
 If congestion occurs, size of
congestion window must be
decreased.
 If a time-out occurs (Strong possibility)

Set the value of the threshold to one half of
the current window size.

It sets the cwnd to the size of one segment.

Starts slow start.
Congestion Detection:
Multiplicative Decrease
 If Three ACK are received (Weak
possibility)

Set the value of the threshold to one half of
the current window size.

It sets the cwnd to the value of threshold.

Starts congestion avoidance.
Figure 37 Congestion example

You might also like