Professional Documents
Culture Documents
INTRODUCTIO
N
Services
Port
Numbers
USER DATAGRAM PROTOCOL
User Datagram
UDP Services
UDP
Applications
Content
Outline
3
TRANSMISSION CONTROL
PROTOCOL
TCP Services
TCP
Features
Segment
A TCP
Connection
State Transition
Diagram Windows in
TCP
Flow Control
Error
Control
Content
Outline
4
SCT
P
SCTP Services
SCTP
Features
Packet Format
An SCTP
Association Flow
Control
Error Control
INTRODUCT
ION
5
UDP(User DatagramProtocol)
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(Transmission Control Protocol)
TCP is a reliable connection-oriented protocol
that can be used in any application where
reliability is important.
SCTP(StreamControl Transmission Protocol)
SCTP is a new transport-layer protocol
that combines the features of UDP and
PORT
NUMBERS
8
Example 24.1
The following is the content of a UDP header
in hexadecimal format.
CB84000D001C001C
a. What is the source port number?
b. What is the destination port number?
c. What is the total length of the user datagram?
d. What is the length of the data?
e. Is the packet directed from a client to a server
or vice versa?
f. What is the client process?
USER DATAGRAM
PROTOCOL
11
Solution
a. The source port number is the first four
hexadecimal digits (CB84)16, which means that the
source port number is 52100.
b. The destination port number is the second four
hexadecimal digits (000D)16, which means that
the destination port number is 13.
c. The third four hexadecimal digits (001C)16define the
length of the whole UDP packet as 28 bytes.
d. The length of the data is the length of the whole
packet minus the length of the header, or 28 − 8 = 20
bytes.
e. Since the destination port number is 13 (well-
USER DATAGRAM
PROTOCOL:
UDP SERVICES
12
Process-to-Process Communication
Connectionless Services
No Flow Control
No Error Control except for the
checksum
Checksum
No Congestion Control
Encapsulation and Decapsulation
Queuing
Multiplexing and Demultiplexing
USER DATAGRAM
PROTOCOL:
UDP SERVICES
13
Checksum
UDP checksum calculation includes three
sections: a pseudoheader, the UDP header, and
the data coming from the application layer.
The p s e udo he a d e r is the part of the header of
the IP packet (discussed in Chapter 19) in which
the user datagram is to be encapsulated with
some fields filled with 0s.
If the checksum does not include the
pseudoheader, a user datagram may arrive safe
and sound. However, if the IP header is corrupted,
it may be delivered to the wrong host.
USER DATAGRAM
PROTOCOL:
UDP SERVICES
14
Process-to-Process
Communication
Stream Delivery Service
Full-Duplex Communication
Multiplexing and Demultiplexing
Connection-Oriented Service
Reliable Service
TRANSMISSION CONTROL
20
PROTOCOL TCP SERVICES
Stream Delivery Service
TCP, 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.
TRANSMISSION CONTROL
21
PROTOCOL TCP SERVICES
Stream Delivery
Service…
Sending and Receiving
Buffers
TRANSMISSION CONTROL
22
PROTOCOL TCP SERVICES
Stream Delivery
Service…
Segment
s
TRANSMISSION CONTROL
PROTOCOL
TCP FEATURES
23
Numbering System
Byte Number
TCP numbers all data bytes (octets) that are transmitted in
a connection. Numbering is independent in each
direction.
The numbering does not necessarily start from 0. Instead,
TCP chooses an arbitrary number between 0 and 232− 1 for
the number of the first byte.
Sequence Number
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.
TRANSMISSION CONTROL
24
PROTOCOL TCP FEATURES
Numbering
System…
Acknowledgment Number
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. which
means that the party takes the number of the last
byte that it has received, safe and sound, adds 1 to
it, and announces this sum as the acknowledgment
number.
TRANSMISSION CONTROL
PROTOCOL
TCP SEGMENT
25
TRANSMISSION CONTROL
26
PROTOCOL TCP SEGMENT
TRANSMISSION CONTROL
PROTOCOL
TCP CONNECTION
27
Persistence Timer
Keepalive Timer
TIME-WAIT Timer
TRANSMISSION CONTROL
50
PROTOCOL TCP TIMERS
Retransmission
Timer
To retransmit lost segments, TCP employs one
retransmission timer (for the whole connection period)
that handles the retransmission time-out (RTO), the
waiting time for an acknowledgment of a segment. We
can define the following rules for the retransmission
timer:
1. When TCP sends the segment in front of the sending queue,
it starts the timer.
2. When the timer expires, TCP resends the first segment in
front of the queue, and restarts the timer.
3. When a segment or segments are cumulatively
acknowledged, the segment or segments are purged from
the queue.
4. If the queue is empty, TCP stops the timer; otherwise,
TCP restarts the timer.
TRANSMISSION CONTROL
51
PROTOCOL TCP TIMERS
Retransmission
Timer…
Round-Trip Time
(RTT)
We need to find how long it takes to send a segment and receive
Measured RTT.
an acknowledgment for it. This is the measured RTT
In TCP, there can be only one RTT measurement in progress at any
time. We use the notation RTTMto stand for measured RTT.
Smoothed
RTT. The measured RTT, RTTM, is likely to change for each round trip.
The fluctuation is so high in today’s Internet that a single measurement
alone cannot be used for retransmission time-out purposes.
Most implementations use a smoothed RTT, called RTTS, which is a
weighted average of RTTMand the previous RTTSas shown below:
In other words, take the running smoothed average value of RTTSand add four
times the running smoothed average value of RTTD(normally a small value).
Karn’s Algorithm
Do not consider the round-trip time of a retransmitted segment in
the calculation of RTTs.
Do not update the value of RTTs until you send a segment and receive
an acknowledgment without the need for retransmission.
TRANSMISSION CONTROL
54
PROTOCOL TCP TIMERS
Retransmission
Timer…
Retransmission Time-out
(RTO)
Exponential
What is theBackoff
value of RTO if a retransmission occurs?
Most TCP implementations use an exponential backoff strategy.
The value of RTO is doubled for each retransmission.
So if the segment is retransmitted once, the value is two
times the RTO.
If it is retransmitted twice, the value is four times the RTO, and
so on.
TRANSMISSION CONTROL
55
PROTOCOL TCP TIMERS
Persistence
Timer
To correct the deadlock, TCP uses a persistence timer
for each connection. When the sending TCP receives
an acknowledgment with a window size of zero, it starts
a persistence timer.
When the persistence timer goes off, the sending
TCP sends a special segment called a probe. This
segment contains only 1 byte of new data.
It has a sequence number, but its sequence number is
never acknowledged; it is even ignored in calculating the
sequence number for the rest of the data.
The probe causes the receiving TCP to resend
the acknowledgment.
TRANSMISSION CONTROL
56
PROTOCOL TCP TIMERS
Thevalueof the persistence timer is set to the value of the retransmission time.
Persistence
However, if a response is not received from the receiver, another probe segment is
Timer…
sent and the valueof the persistence timer is doubledand reset.
Thesender continues sending the probe segments and doubling and resetting the value
of the persistence timer until the value reaches a threshold (usually 60 s).
After that the sender sends oneprobe segment every 60 seconds until the window is
reopened.
TRANSMISSION CONTROL
57
PROTOCOL TCP TIMERS
A keepalive timer isused in some implementations to prevent a long idle connection
Keepalive
between two TCPs e.g. a aerverand a client.
Timer
Each time the server hears from a client, it resets this timer.
The time-out is usually 2 hours. If the serverdoes not hear from the client after 2
hours, it sends a probe segment.
If there isnoresponse after 10 probes, each of which is 75 seconds apart, it assumes that
the client is down and terminates the connection.
TRANSMISSION CONTROL
58
PROTOCOL TCP TIMERS
TIME-WAIT
Timer
The TIME-WAIT (2MSL) timer is used during connection
termination. The maximum segment lifetime (MSL) is
the amount of time any segment can exist in a network
before being discarded.
The implementation needs to choose a value for
MSL. Common values are 30 seconds, 1 minute, or
even 2 minutes.
The 2MSL timer is used when TCP performs an
active close and sends the final ACK.
The connection must stay open for 2 MSL amount of
time to allow TCP to resend the final ACK in case the
ACK is lost.
This requires that the RTO timer at the other end
TRANSMISSION CONTROL
PROTOCOL
OPTIONS
59
Communication
Multiple Streams
Multihoming
Full-Duplex Communication
Connection-Oriented Service
Reliable Service
TRANSMISSION
PROTOCOL:
62
SERVICE
SSCTP allows multistream service in each connection,
Multiple
which is called association in SCTP terminology.
Streams
If one of the streams is blocked, the other streams can still deliver their
data.
TRANSMISSION
PROTOCOL:
63
SERVICE
SIn TCP connection a multihomed host (connected to morethan one
Multihoming
physical
address with multiple IP addresses), only one of these IP addresses
per end can be utilizedduring the connection.
An SCTP association, supports multihoming service. The
sending and receiving host can define multiple IP addresses in each end
for
an association.
TRANSMISSION
PROTOCOL:
64
FEATURE
S
Transmission Sequence Number (TSN)
Header
TRANSMISSION
PROTOCOL:
68
PACKET
FORMAT
Chunk
Types of
Chunks
TRANSMISSION
PROTOCOL:
69
AN SCTP
ASSOCIATION
A connection in SCTP is called an association
to emphasize multihoming.
Association establishment in SCTP requires a
four-way handshake.
TRANSMISSION
PROTOCOL:
70
AN SCTP
ASSOCIATION
Data
Transfer
SCTP recognizes and maintains boundaries.
Transfer…
Multihoming Data Transfer
Multihoming allows both ends to define multiple IP
addresses for communication. However, only one of
these addresses can be defined as the primary
address; the rest are alternative addresses.
Data transfer, by default, uses the primary address of
the destination. If the primary is not available, one of
the alternative addresses is used.
The process, however, can always override the primary
address and explicitly request that a message be sent
to one of the alternative addresses.
A process can also explicitly change the primary
address of the current association.
TRANSMISSION
PROTOCOL:
72
AN SCTP
ASSOCIATION
Data
Transfer…
Multistream Delivery
SCTP differentiates between data transfer and
data delivery.
SCTP uses TSN numbers to handle data
transfer, movement of data chunks between the
source and destination.
The delivery of the data chunks is controlled by
stream identifier(SI) and stream sequence numbers
(SSN).
SCTP can support multiple streams, a message can
belong to one of these streams. Each stream is
assigned a unique stream identifier (SI).
SCTP supports two types of data delivery in each
TRANSMISSION
PROTOCOL:
73
AN SCTP
ASSOCIATION
Fragmentation
Data
Fragmentation in IP and SCTP belong to different levels: the former at the network
Transfer…
layer, thelatter at the transport layer.
SCTP preserves the boundariesof the message from process to process when creating a
DATA chunk from a message if the size of the message does notexceedthe MTU of
the path.
If the total size exceeds the MTU, the message needs to be fragmented. (For more
details about fragmentation, see the Extra Materials section.)
TRANSMISSION
PROTOCOL:
74
AN SCTP
ASSOCIATION
Association Termination
Site
The receiver has one buffer (queue) and
three variables.
first variable holds the last TSN received,
cumTSN
second variable holds the available buffer size,
winSize
third variable holds the last cumulative
acknowledgment,
lastACK
TRANSMISSION
PROTOCOL:
77
FLOW
CONTROL
Sender
Site
The sender has one buffer (queue) and three
variables (Figure 24.48). We assume each chunk
is 100 bytes long.
first variable, curTSN, refers to the next chunk to be
sent
second variable, rwnd, holds the last value advertised
by the receiver (in bytes)
third variable, inTransit, holds the number of bytes
in transit,
TRANSMISSION
PROTOCOL:
78
ERRORCONTROL
SCTP, like TCP, is a reliable transport-layer
protocol.
It uses a SACK chunk to report the state of
the receiver buffer to the sender.
Each implementation uses a different set of
entities and timers for the receiver and
sender sites.
Here, a very simple design is used to
convey the concept to the reader.
TRANSMISSION
PROTOCOL:
79
ERROR
CONTROL
Receiver
Site
TRANSMISSION
PROTOCOL:
80
ERROR
CONTROL
Sender
Site
At the sender site, our design demands two
buffers (queues): a sending queue and a
retransmission queue.
We also use three variables: rwnd, inTransit, and
curTSN, as described in the previous section.
TRANSMISSION
PROTOCOL:
81
ERROR
CONTROL
Sender
Site…
To see how the state of the sender changes,
assume that the SACK in Figure 24.49 arrives at
the sender site in Figure 24.50. Figure 24.51
shows the new state.
TRANSMISSION
PROTOCOL:
82
ERROR
CONTROL
Sending Data
Chunks
An end can send a data packet whenever there
are data chunks in the sending queue with a TSN
greater than or equal to curTSN or if there are
data chunks in the retransmission queue.
The retransmission queue has priority.
However, the total size of the data chunk or
chunks included in the packet must not exceed
the (rwnd − inTransit) value and the total size of
the frame must not exceed the MTU size, as we
discussed in previous sections.
TRANSMISSION
PROTOCOL:
83
ERROR
CONTROL
Sending Data
Chunks…
To control a lost or discarded chunk, SCTP, like
TCP, employs two strategies: using retransmission
timers and receiving three SACKs with the same
missing chunks.
Retransmission.
SCTP uses a retransmission timer, which handles the
retransmission time, the waiting time for an
acknowledgment of a segment. The procedures for
calculating RTO and RTT in SCTP are the same as we
described for TCP. SCTP uses a measured RTT
(RTTM), a smoothed RTT (RTTS), and an RTT
deviation (RTTD) to calculate the RTO. SCTP also uses
Karn’s algorithm to avoid acknowledgment ambiguity.
TRANSMISSION
PROTOCOL:
84
ERROR
CONTROL
Sending Data
Chunks…
Four Missing Reports.
87