0% found this document useful (0 votes)
2 views78 pages

Module4 Part1

The document discusses the transport layer's role in process-to-process delivery, highlighting the differences between connectionless (UDP) and connection-oriented (TCP) services. It covers key concepts such as addressing, port numbers, multiplexing, and the client/server paradigm, as well as the reliability of protocols. Additionally, it details the operations of UDP and TCP, including their packet structures, flow control, and error management mechanisms.
Copyright
© All Rights Reserved
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% found this document useful (0 votes)
2 views78 pages

Module4 Part1

The document discusses the transport layer's role in process-to-process delivery, highlighting the differences between connectionless (UDP) and connection-oriented (TCP) services. It covers key concepts such as addressing, port numbers, multiplexing, and the client/server paradigm, as well as the reliability of protocols. Additionally, it details the operations of UDP and TCP, including their packet structures, flow control, and error management mechanisms.
Copyright
© All Rights Reserved
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

Module 4

23.1
Chapter 23
Process-to-Process Delivery:
UDP, TCP

23.2 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
 Network Layer:
 oversees source-to-destination delivery of
individual packets, it does not recognize
any relationship between those packets.
 treats each one independently, as though
each piece belonged to a separate
message, whether or not it does.
 Transport layer:
 ensures that the whole message arrives
intact and in order, overseeing both error
control and flow control at the source-to-
destination level.

23.3
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 – Addressing, IANA ranges, Socket Addresses
Multiplexing and Demultiplexing
Connectionless Versus Connection-Oriented Service
Reliable Versus Unreliable
Three Protocols
23.4
Note

The transport layer is responsible for


process-to-process delivery.

23.5
23.6
Transport layer protocol:
• can be either connectionless or connection-oriented.

• Connectionless transport layer :


• treats each segment as an independent packet and
delivers it to the transport layer at the destination
machine. Ex: UDP
• Connection-oriented transport layer:
• makes a connection with the transport layer at the
destination machine first before delivering the
packets. After all the data is transferred, the
connection is terminated. Ex: TCP - creates a
relationship between the segments using sequence
numbers.

23.7
Transport layer protocols:

o UDP
o TCP
o SCTP

23.8
node-to-node delivery :

DATA LINK LAYER

host-to-host delivery :

NETWORK LAYER

process-to-process delivery:

TRANSPORT LAYER

23.9
Figure 23.1 Types of data deliveries

23.10
23.11
Client/Server Paradigm
• most common way to achieve process-to-process
communication.
• A process on the local host - a client, needs
services from a process usually on the remote
host - a server.
• Both processes (client and server) have the same
name.

23.12
Addressing

• Whenever we need to deliver something to one


specific destination among many, we need an
address.
• data link layer - MAC address to choose one node
among several nodes
• network layer - IP address to choose one host
among millions.
• transport layer - a transport layer address, called
a port number, to choose among multiple
processes running on the destination host.

23.13
Port Number

• In the TCP/IP protocol suite, the port numbers are


integers between 0 and 65,535 (16-bit).
• Client program defines itself with a port number,
chosen randomly by the transport layer software
running on the client host. This is the ephemeral
(temporary/short-lived) port number.
• Server process must also define itself with a port
number - cannot be chosen randomly – as client
will not know the port number - Use universal port
numbers for servers; these are called well-known
port numbers.

23.14
Figure 23.2 Port numbers

23.15
Figure 23.3 IP addresses versus port numbers

23.16
ICANN (Internet Corporation for Assigned Names and Numbers) ranges

• not assigned or controlled by


lCANN.
• can only be registered with
lCANN to prevent duplication

(assigned • neither controlled


and nor registered.
controlled by • can be used by
lCANN) any process.
• These are the
ephemeral ports

23.17
Figure 23.5 Socket address

Combination of an IP address and a port number is called a


socket address.

Transport layer protocol needs a pair of socket addresses: the


client socket address and the server socket address.

IP header contains the IP addresses; the UDP or TCP header


contains the port numbers.

23.18
Figure 23.6 Multiplexing and demultiplexing

23.19
Connectionless Versus Connection-Oriented Service
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:
• Here, 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
23.20
Reliable Versus Unreliable
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.
• UDP is connectionless and unreliable.

Reliable:
• 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.
• TCP and SCTP are connection-oriented & Reliable.

23.21
Figure 23.7 Error control

23.22
Figure 23.8 Position of UDP, TCP, and SCTP in TCP/IP suite

23.23
23.24
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
23.25
If UDP is so powerless, why would a process want to use it?

23.26
Some Advantages..

23.27
 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 by using UDP takes much less
interaction between the sender and receiver than using TCP or
SCTP.

23.28
Table 23.1 Well-known ports used with UDP

23.29
Example 23.1

In UNIX, the well-known ports are stored in a file called


/etc/services. Each line in this file gives the name of the
server and the well-known port number. We can use the
grep utility to extract the line corresponding to the desired
application. The following shows the port for FTP. Note
that FTP can use port 21 with either UDP or TCP.

23.30
Example 23.1 (continued)

SNMP uses two port numbers (161 and 162), each for a
different purpose.

23.31
UDP packets -> called -> USER DATAGRAMS.

23.32
User Datagram
Figure 23.9 User datagram format

23.33
Note

UDP length
= IP length – IP header’s length

23.34
23.35
23.36
CHECKSUM

23.37
UDP checksum calculation includes
three sections:

a pseudoheader,

the UDP header, and

the data coming from the application layer.

23.38
Figure 23.10 Pseudoheader for checksum calculation

Section 1

Section 2

Section 3

Pseudoheader is the part of the header of the IP packet in which the user
datagram is to be encapsulated with some fields filled with Os

23.39
23.40
Example 23.2
Figure 23.11 shows the checksum calculation for a very
small user datagram with only 7 bytes of data. Because
the number of bytes of data is odd, padding is added for
checksum calculation. The pseudoheader as well as the
padding will be dropped when the user datagram is
delivered to IP.

Calculation of the checksum and its inclusion in a user


datagram are optional.
Checksum not calculated -> field is filled with 1s.
Note - a calculated check sum can never be all 1s because
this implies that the sum is all Os, which is impossible
because it requires that the value of fields to be Os.
23.41
Figure 23.11 Checksum calculation of a simple UDP user datagram

23.42
UDP Operation
• Connectionless Services

• Flow & Error Control


• Encapsulation and Decapsulation
• Queuing

23.43
23.44
Figure 23.12 Queues in UDP

23.45
Queuing – Client Site
• At client site -> when a process starts - > requests a port number from
the operating system. (Some implementations create both an incoming
and an outgoing queue associated with each process.)
• Process wants to communicate with multiple processes?? -> still
obtains only one port number and eventually one outgoing and one
incoming queue.
• Client queues -> identified by ephemeral port numbers. The queues
function as long as the process is running. Process terminates ->
queues destroyed.
• The client process can send messages to the outgoing queue by using
the source port number specified in the request. UDP removes the
messages one by one and, after adding the UDP header, delivers them
to IP.
• An outgoing queue can overflow. If this happens, the operating
system can ask the client process to wait before sending any more
messages
23.46
Queuing – Server Site
• Server site - > a server asks for incoming and outgoing queues, using
its well-known port, when it starts running. The queues remain open
as long as the server is running.
• Message arrives at server -> UDP checks if an incoming queue
created for the port number specified in the destination port number
field of the user datagram.
• Queue present -> UDP sends the received user datagram to the end of
the queue. No queue -> UDP discards the user datagram and asks the
ICMP protocol to send a port unreachable message to the client.
• All the incoming messages for one particular server, whether coming
from the same or a different client, are sent to the same queue. An
incoming queue can overflow.
• If this happens, UDP drops the user datagram and asks for a port
unreachable message to be sent to the client.

23.47
Use of UDP
• Suitable for a process that requires simple request-response
communication (with flow and error control). It is not usually
used for a process such as FTP that needs to send bulk data.
• 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.
• Suitable transport protocol for multicasting. Multicasting
capability is embedded in the UDP software but not in the TCP
software.
• Used for management processes such as SNMP.
• Used for some route updating protocols such as Routing
Information Protocol.

23.48
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
23.49
Table 23.2 Well-known ports used by TCP

23.50
TCP Services:
 Process-Process Communication
 Stream delivery Service
 Sending and Receiving Buffers
 Segments
 Full Duplex Communication
 Connection-Oriented Service
 Reliable Service

23.51
Figure 23.13 Stream delivery

23.52
Figure 23.14 Sending and receiving buffers

23.53
UDP packets -> called ->
USER DATAGRAMS.

TCP packets -> called ->


SEGMENTS

23.54
Figure 23.15 TCP segments

23.55
Note

The bytes of data being transferred in


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

23.56
Note

The value in the sequence number field


of a segment defines the
number of the first data byte
contained in that segment.

23.57
Example 23.3
Suppose a TCP connection is transferring a file of 5000
bytes. The first byte is numbered 10,001. What are the
sequence numbers for each segment if data are sent in
five segments, each carrying 1000 bytes?

The following shows the sequence number for each


segment:

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

23.59
Figure 23.16 TCP segment format

23.60
Figure 23.17 Control field

23.61
Table 23.3 Description of flags in the control field

23.62
A TCP Connection

• A connection-oriented transport protocol establishes a virtual


path between the source and destination.
• TCP operates at a higher level. TCP uses the services of IP to
deliver individual segments to the receiver, but it controls the
connection itself.
• If a segment is lost or corrupted, it is retransmitted. Unlike TCP,
IP is unaware of this retransmission. If a segment arrives out of
order, TCP holds it until the missing segments arrive; IP is
unaware of this reordering.
• In TCP, connection-oriented transmission requires three phases:
connection establishment, data transfer and connection
termination.

23.63
Figure 23.18 Connection establishment using three-way handshaking

B A

23.64
23.65
Note

A SYN segment cannot carry data, but it


consumes one sequence number.

23.66
Note

A (SYN + ACK) segment cannot


carry data, but does consume one
sequence number.

23.67
Note

An ACK segment, if carrying no data,


consumes no sequence number.

23.68
Figure 23.18 Connection establishment using three-way handshaking

B A

SYN Flooding
Simultaneous
23.69
Attack
Open
Figure 23.19 Data transfer

23.70
23.71
PUSH
The application program at the sending site can request a
push operation -> sending TCP must not wait for the window
to be filled.
It must create a segment and send it immediately.
The sending TCP must also set the push bit (PSH) to let the
receiving TCP know that the segment includes data that
must be delivered to the receiving application program as
soon as possible and not to wait for more data to come.

23.72
Urgent Data:
For urgent bytes -> means sending application wants a piece
of data to be read out of order by the receiving application.
URG bit set.
The sending application program tells the sending TCP that
the piece of data is urgent.
The sending TCP creates a segment and inserts the urgent
data at the beginning of the segment.
The rest of the segment can contain normal data from the
buffer.
The urgent pointer field in the header defines the end of the
urgent data and the start of normal data.
When the receiving TCP receives a segment with the URG bit
set, it extracts the urgent data from the segment, using the
value of the urgent pointer, and delivers them, out of order,
to the receiving application program.
23.73
Figure 23.20 Connection termination using three-way handshaking

23.74
23.75
Note

The FIN segment consumes one


sequence number if it does
not carry data.

23.76
Note

The FIN + ACK segment consumes


one sequence number if it
does not carry data.

23.77
Figure 23.21 Half-close

In TCP, one end


can stop
sending data
while still
receiving data.
This is called a
half-close
(normally by
client).
Ex: Sorting

23.78

You might also like