Sie sind auf Seite 1von 27


• I. Process-to-Process Delivery
Transport layer protocols
• II. UDP (User Datagram Protocol)
• III. TCP (Transmission Control Protocol)
• IV. SCTP (Stream Control Transport Protocol)

Chapter 23 Process-to-Process Delivery: UDP, TCP, and SCTP

(Forouzan, Data Communications and Networking, 4th Edition)

1 2


Figure 23.1 Types of data deliveries

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 The transport layer is responsible for
Connectionless Versus Connection-Oriented Service process-to-process delivery.
Reliable Versus Unreliable
Three Protocols
3 4
Transport layer concept Process
• Network layer is responsible for source-to-
destination delivery of an individual packet
Internet Internet Antivirus MSN E-mail
• Transport layer ensures that the whole message Explorer Explorer Software Messenger
arrives intact and in order
—Provide error control, flow control, and in-sequence
delivery, on an end-to-end basis • Operating system today
• Also ensure delivery from one process to supports both multiuser and
another process multitasking environment
—Process-to-process delivery • Can be in the form of
—Process is identified by port number • Client-server
• Real communication takes place between two communication
processes or application programs • Peer-to-peer
5 communication 6

Transport Layer Address Figure 23.4 IANA ranges

• Process can be identified by port number

—Identify multiple processes running on the same
destination host
• Usually has 16 bits, or 65536 available ports
— Well-known ports (0-1023) are assigned and • Well-known port is often used by server process
controlled by IANA (Internet Assigned Number to allow remote clients to connect to
—Ex. Daytime server process always uses port 13
— Registered ports (1024-49,151) are neither
assigned nor controlled by IANA, but can be • Other ports are often randomly chosen by the
registered to avoid duplication client to identify various client processes
— Dynamic ports (49,152-65,535) can be used by any running on the same host
—Ex. Daytime client process randomly pick port 52,000
to identify itself
7 8
Figure 23.2 Port numbers Figure 23.3 IP addresses versus port numbers

To Form
Form To

9 10

Figure 23.5 Socket address Figure 23.6 Multiplexing and demultiplexing

• Combination of IP address and port number is

called a socket address
—IP header contains IP address
—Transport layer header contains port number

• Transport protocol accepts message from different processes

— Differentiated by their assigned port number
• Transport protocol adds header (with port number) and
11 passes packet to the network layer 12
Connectionless vs.
Connection-oriented Services
• Connectionless service
—No connection establishment or connection release
—Packets are not numbered
—No acknowledgement
—Example is UDP, User Datagram Protocol
• Connection-oriented service
—Need to establish and release a connection
—Examples are TCP and SCTP

13 14

Reliable vs. Unreliable Figure 23.7 Error control

• Transport protocol can be made reliable by
implementing flow and error control
—Also result in a slower and more complex service
—TCP and SCTP are connection-oriented and reliable
• UDP is connectionless and unreliable

• We need reliable services at both transport layer

and data link layer
—Flow and error control at data link layer cannot
guarantee that error will not occur at network layer
15 16
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
UDP Operation
Use of UDP
17 18

Table 23.1 Well-known ports used with UDP

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.

19 20
Example 23.1 (continued) Figure 23.9 User datagram format
SNMP uses two port numbers (161 and 162), each for a
different purpose, as we will see in Chapter 28.

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

• Length = Length of user datagram (UDP header + data)
called C:\WINDOWS\system32\drivers\etc\services. — Also available in IP header

UDP length
= IP length – IP header’s length
21 22

UDP Checksum Figure 23.10 Pseudo header for checksum calculation

• Include three sections: pseudo header, UDP

header, and data from application layer
• Checksum is used to detect error over the entire
user datagram (header + data)
—Checksum in IP header is only used to detect error in
IP header
• Value of protocol field for UDP is 17
• UDP checksum usage is optional
—All 1s is used if checksum is not calculated

23 24
Example 23.2 Figure 23.11 Checksum calculation of a simple UDP user datagram

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.

25 26

UDP Operation Queue in UDP (1)

• Connectionless service • UDP queues are associated with ports
— Each datagram is independent from one another
— Datagram is not numbered
• Queue is available when process is running
— There is no connection establishment and termination —Queue is destroyed when process exists
— Cannot transport stream of data • Outgoing queue
• Application will need to chop data stream into packet first
—Source sends message by putting it into UDP queue
• Flow and Error Control associated with the source port number
— No flow control: Receiver may overflow with incoming messages
—UDP removes message one-by-one, adds UDP
— Checksum provides simple error detection
header, and delivers them to IP
• Packet is silently discarded if checksum is invalid
• But there is no error correction —Outgoing UDP queue can overflow
• Sender will not know if a message has been lost or duplicated • Operating system will ask the sending process to wait
• Encapsulation and Decapsulation
27 28
Queue in UDP (2) Figure 23.12 Queues in UDP

• Upon message arrival, UDP looks for the

incoming queue associated with the destination
port number
—If queue exists, UDP places the received datagram
into the queue
—If queue does not exist, UDP discards the received
datagram and sends ICMP port unreachable message
back to the sender
—If incoming queue is overflow, UDP also discards the
received datagram and sends ICMP port unreachable
message back to the sender
• Reply is sent back to the source port number
specified in the received UDP message
29 30

23-3 TCP
UDP Applications
• Simple request-response communication TCP is a connection-oriented protocol; it creates a
—Little concern on flow and error control virtual connection between two TCPs to send data. In
• Process with internal flow and error control addition, TCP uses flow and error control mechanisms
mechanisms at the transport level.
• Multicasting (one-to-many communication)
—Multicasting is only supported by UDP Topics discussed in this section:
TCP Services
• Management process such as SNMP
TCP Features
• Routing protocol such as Routing Information Segment
Protocol (RIP) A TCP Connection
Flow Control
Error Control
31 32
Table 23.2 Well-known ports used by TCP

Services Offered by TCP

• Process-to-process communication
• Stream delivery service
—TCP is a stream-oriented protocol
—Neither IP nor UDP recognizes any relationship
between the datagrams
Sending Receiving

• Full-Duplex communication
—Data flows in both directions at the same time
• Connection-oriented with setup and tear-down
• Reliable service via acknowledgement mechanism
33 34

Figure 23.13 Stream delivery Figure 23.14 Sending and receiving buffers

• TCP allows sending process to deliver data as a

stream of bytes and allow receiving process to
obtain data as a stream of bytes
• Two processes are connected by an imaginary
tube 35 36
Sending and Receiving Buffers Figure 23.15 TCP segments

• Two circular buffers of 20 bytes each

• White section contains empty chamber
• On the transmitting side
—Grey area holds bytes that have been sent but not
yet acknowledged
• After bytes in grey chambers are acknowledged, chambers
can be recycle and available for use for new data
—Pink area contains bytes to be sent
• On the receiving side
—Pink area contains received bytes that can be read by
the receiving process 5 bytes 3 bytes
37 38

TCP Segment TCP Numbering System

• Even if TCP transport stream of data, the • Enable the previously mentioned services
underlying IP layer needs to send data in • TCP relies on sequence number and
packets acknowledgement number
—Not a stream of bytes
• TCP numbers all data bytes that are transmitted
• TCP groups a number of bytes together into a in a connection
packet called segment —Numbering is independent in each direction
—Also add header to each segment and —Randomly choose number between 0 and 232-1 for
—Deliver the segment to IP layer for transmission the first bytes
• Segment may be received out-of-order, lost, or —If random number is 1057 and a total of 6000 bytes
corrupted need to be sent, the bytes are numbered from 1057
to 7056
—TCP resent segment as necessary
39 40
TCP Sequence Number (1) Example 23.3
Suppose a TCP connection is transferring a file of 5000
The bytes of data being transferred in each bytes. The first byte is numbered 10,001. What are the
connection are numbered by TCP. sequence numbers for each segment if data are sent in
The numbering starts with a randomly five segments, each carrying 1000 bytes?
generated number.
• Sequence number for each segment is the Solution
number of the first byte carried in that segment The following shows the sequence number for each
The value in the sequence number field of a
segment defines the number of the first data
byte contained in that segment.

41 42

TCP Sequence Number for

Control Segment TCP Acknowledgement Number
• If a segment contains control information, one • Acknowledgement (ACK) number confirms the
sequence number is consumed bytes it has received
—As though 1 imaginary byte is carried • ACK number defines the number of the next
—Necessary to enable acknowledgement byte that it expects to receive
—Connection establishment, termination, or abortion • ACK number is cumulative
• If a segment contains no data, the sequence —ACK number = 5643 means that it has received all
number field has no meaning bytes from the beginning up to 5642
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.
43 44
TCP Services Figure 23.16 TCP segment format

• Flow control
—Receiver can control the amount of data that are to
be sent by the sender
• Error control
—Error in data segment is detected by checksum
—Retransmission of error segment is used to provide
reliable service
• Congestion control
—Amount of data that can be transmitted also depends
on level of congestion in the network

45 46

Figure 23.17 Control field

TCP Header (1)
• Basic header is 20 bytes, with up to 40
additional bytes for TCP options
• Source and destination port addresses serve the
same purpose as those in UDP header
• Sequence number indicates the number Table 23.3 Description of flags in the control field
assigned to the first byte of data contained in
this TCP segment
—Initial sequence number is generated randomly
• Acknowledgement number indicates the byte
number that this node is expecting to receive
—ACK and data can be piggybacked together

47 48
TCP Header (2) TCP Connection
• Header length defines the length of TCP header • TCP is connection-oriented
in a unit of 4-bytes • TCP uses the service of IP (connectionless) but
— 4 bits allow up to 60 bytes (15 x 4) bytes for header
• Window size indicates the number of bytes —Retransmit a lost or corrupted segment
which this host is willing to accept
—Hold any out-of-order segment until the missing
—Beginning with the one indicated in the
acknowledgment field segment arrives

• Checksum also follows the same procedure as • Consists of three phases

UDP checksum —Connection establishment
—Pseudoheader is also used, with protocol value = 6 —Data transfer
• Urgent pointer defines the last urgent byte —Connection termination
—Store a number that must be added to sequence no.
49 50

TCP Connection Establishment

(1) Figure 23.18 Connection establishment using three-way handshaking

• Each party must initialize communication and

get approval from the other party before
transferring any data
— Called three-way handshaking
• Typically initiated from client to server
1. Server makes itself ready to accept connection
by entering a “passive open” state
2. Client send SYN segment for synchronization of
sequence number
• SYN segment consumes one imaginary byte

A SYN segment cannot carry data, but it consumes one

sequence number.
51 52
TCP Connection Establishment
(2) SYN Flooding Attack
3. Server sends a dual purpose segment • Attacker sends a large number of SYN
• ACK to acknowledge the previous SYN segment segments to a server
• Its own SYN for communication in the other direction — Pretending that each one arrives from a different
(server to client) client by faking source IP address
• Also consumes one imaginary byte • Server allocates necessary resource that will
A SYN + ACK segment cannot carry data, but does never get used
consume one sequence number. — Table, memory, timer, port, handle
4. Client send ACK segment to acknowledge the • Belong to a type of security attack known as
previous SYN+ACK segment denial-of-service attack
• Same sequence number as the original SYN segment • One solution is to postpone resource allocation
An ACK segment, if carrying no data, consumes no until the entire connection is set up
sequence number. 53 54

Figure 23.19
TCP Data Transfer Data transfer

• Data transfer is bi-directional

• Acknowledgement can be piggybacked with the
• Push flag (PSH) tell the receiver to deliver data
to application layer as soon as they are received
— Useful for interactive application
• If push flag is off, receiving TCP can choose
when to pass this data to its server application
— For example, receiving TCP can wait for a full buffer
before passing data to its application layer
— Flexibility in TCP operation leads to protocol efficiency
55 56
TCP Data Transfer: Urgent Data TCP Connection Termination
• Sending application may want a piece of data to • Called three-way handshaking
be delivered out-of-order by the receiver 1. Client sends FIN segment with FIN flag set to
— For example, an abort command (control-C) the server
— May or may not include last chunk of data
• Urgent data must be at the beginning of the
2. Server sends a dual-purpose segment, FIN+ACK
— ACK to confirm the receipt of FIN segment from client
— Urgent pointer points to the end of urgent data and
— FIN to announce the closing of connection in the other
the start of normal data direction
— Normal data can be at the end of the same segment — Can also contain the last segment of data from server
• Receiving TCP process will extract urgent data 3. Client sends ACK segment to confirm the receipt
and deliver them out-of-order to its application of FIN+ACK from the server
layer — Acknowledgement number is advanced by 1
57 — Cannot carry any data 58

TCP Connection Termination:

Figure 23.20 Connection termination using three-way handshaking
• Closing the connection in one direction at a time
The FIN segment — Stop sending data but expect to continue receiving data
consumes one • Useful when server needs all data before begin
sequence number processing
if it does not carry — Sorting application or HTTP request
data. • Server accept half-close status by sending the ACK
— Instead of FIN+ACK in three-way handshake
The FIN + ACK • Data can still flow in one direction, server to client
segment — Client can only send ACK to server, but not any additional data
consumes one • All transmissions from client uses the same sequence number
sequence number • After server sent all processed data back, it can send FIN
if it does not carry segment to client
data. • Handshake is completed with the last ACK segment from
59 client 60
Figure 23.21
Half-close TCP Flow Control
• Called sliding window protocol
— Based on Go-Back-N protocol because it does not use
— Based on Selective Repeat because the receiver holds
out-of-order segment until the missing one arrives
• Bytes inside the window are the bytes that can
be in transit
— Can be sent without worrying about acknowledgement
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.
61 62

Figure 23.22 Sliding window 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?

The value of rwnd = 5000 − 1000 = 4000. Host B can
• rwnd = Receiver window receive only 4000 bytes of data before overflowing its
— Value advertised by the opposite end in a segment containing
buffer. Host B advertises this value in its next segment to
— Reflects the number of bytes that the receiver can accept before A.
its buffer overflow and data are discarded
• cwnd = Congestion window
— Will be discussed in the next Chapter
63 64
Example 23.5 Example 23.6

What is the size of the window for host A if the value of Figure 23.23 shows an unrealistic example of a sliding window. The
rwnd is 3000 bytes and the value of cwnd is 3500 bytes? 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
Solution this value is thousands of bytes). The size of the sender window is
The size of the window is the smaller of rwnd and cwnd, the minimum of rwnd and cwnd, or 9 bytes. Bytes 200 to 202 are
which is 3000 bytes. sent, but not acknowledged. Bytes 203 to 208 can be sent without
worrying about acknowledgment. Bytes 209 and above cannot be

65 66

Figure 23.23 Example 23.6 Note

Some points about TCP sliding windows:

ҩ The size of the window is the lesser of rwnd and
ҩ 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
ҩ 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.
67 68
TCP Error Detection and
TCP Error Control Correction Tools
• Application relies on TCP to deliver the entire stream of 1. Checksum
— In order
2. Acknowledgement
— Without error • Confirm receipt of data segment
— Without loss • Control segments that carry no data but consume a
— Without duplication sequence number are also acknowledged
• TCP error control includes mechanism to detect ACK segments do not consume sequence numbers
— Corrupted segment and are not acknowledged.
— Lost segment
— Out-of-order segment
3. Retransmission Time-out
— Duplicated segment • Corrupted, lost, or delayed segment is retransmitted
after time-out
• TCP error control includes mechanism to correct error
after they are detected • Also retransmitted after three duplicated ACKs
69 70

Figure 23.24
Normal operation
TCP Retransmission ACK may be delayed by 500 ms to
wait for any additional segments
• Retransmission after Retransmission Time-Out (RTO)
— TCP maintains one RTO timer for all unacknowledged segments
— When the timer matures, the earliest outstanding segment is
— RTO is dynamically calculated from Round-Trip Time (RTT)
• RTT = Time needed for a segment to reach a destination and for an
ACK to be received
• Retransmission after three duplicated ACK segments
— Allow immediate retransmission before RTO
— Also called fast retransmission
In modern implementations, a retransmission occurs
if the retransmission timer expires or three duplicate
ACK segments have arrived.
No retransmission timer is set for an ACK segment.71 72
TCP Operation with Lost
TCP In-sequence Delivery Segment
• Segment may arrive out-of-order if the previous • Lost and corrupted segments are treated the
segment is same way by the receiver
— Delayed • Receiver stores data in its buffer
— Lost or discarded — But leaves a gap to indicate that there is no continuity
• Out-of-order segment is hold by TCP until the in the data
missing segment arrives — Also immediately send ACK to the sender with the
— Out-of-order segments are not delivered to the next byte that it expects
application layer — Store bytes 801 to 900 but never delivers them to
application until the gap is filled
Data may arrive out of order and be temporarily stored • Third ACK changes according to the updated
by the receiving TCP, but TCP guarantees that no out- status
of-order segment is delivered to the process.
The receiver TCP delivers only ordered data to the process.
73 74

Figure 23.25 Lost segment TCP Fast Retransmission

• Fourth, Fifth, and Sixth segments trigger
acknowledgement message
• Sender receives four ACK with the same value
— Ack = 301 (referring to the third segment)
— Four ACKs = Three duplicates
• Segment 3 is immediately retransmitted
— Before RTO expires
— All four ACKs say that the third segment is missing
• Only one segment (the third one) is retransmitted even
though four segments are not acknowledged
— Receiver knows that the other three segments (4-6) arrive safely
because . . .

75 76
Figure 23.26 Fast retransmission
TCP Acknowledgement Number
• Acknowledgement (ACK) number confirms the
bytes it has received
• ACK number defines the number of the next
byte that it expects to receive
• ACK number is cumulative
—ACK number = 5643 means that it has received all
bytes from the beginning up to 5642
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.
77 78

IV. Stream Control Transmission

Protocol (SCTP) UDP, TCP, and SCTP
• UDP is a message-oriented protocol
SCTP is a new reliable, message-oriented transport — Message boundary is preserved
layer protocol. SCTP, however, is mostly designed for — Messages are independent from one another
Internet applications that have recently been — Unreliable
introduced. It combines the best features of UDP and • TCP is a byte-oriented protocol
TCP. These new applications need a more — Message boundary is not preserved
sophisticated service than TCP can provide. — Provide reliable service, congestion control, and flow
Topics discussed in this section: • SCTP is a reliable message-oriented protocol
SCTP Services and Features — Message boundary is preserved
Packet Format — Provide reliable service, in-order delivery, congestion
An SCTP Association control, and flow control
Flow Control and Error Control 79 80
Table 23.4 Some SCTP applications Figure 23.27 Multiple-stream concept

• Each connection can have multiple streams

— If one is blocked, others streams can still deliver data
An association in SCTP can involve multiple streams.
81 82

Figure 23.28 Multihoming concept

SCTP Services
• Process-to-process communication
• Multiple streams
• Multi-homing
• Full-duplex communication
• Connection-oriented service
— SCTP connection is called association
• Each end can have multiple IP addresses • Reliable service
— When one path fails, another interface can be used
without interruption
— But only one can be active at any given time
SCTP association allows multiple IP addresses for
each end. 83 84
SCTP Identification Numbers SCTP Packet and Data Chunk
• Transmission Sequence Number (TSN) • Data are carried as data chunk
— Identify unit of data (data chunk) — Each data chunk always carries TSN, SI, and SSN
— Similar role as TCP sequence number • Control information is carried as control chunk
• Stream Identifier (SI) • Several control and data chunks can be packed
— Identify each stream in an association together in a packet
• Stream Sequence Number (SSN) • SCTP packet plays the same role as TCP
— Maintain in-order delivery for each stream segment
In SCTP, a data chunk is numbered using a TSN. TCP has segments; SCTP has packets.
To distinguish between different streams, SCTP uses an SI.
To distinguish between different data chunks belonging to
the same stream, SCTP uses SSNs. 85 86

Figure 23.29 Comparison between a TCP segment and an SCTP packet

SCTP Packet Headers
• Each end point can have multiple IP addresses
— Need verification tag to identify a unique end point
• That can have multiple IP addresses
• Each data chunk carries TSN, SI, and SSN
— Carry user data
• Control chunk does not use TSN, SI, or SSN
• What is the difference between TCP and SCTP? — Control and maintain association

In SCTP, control information and data information are

carried in separate chunks. 87 88
SCTP Example Packets
Figure 23.30 Packet, data chunks, and streams

• If we want to send 11 messages in 3 streams

— 4 messages in the first stream
— 3 messages in the second stream
— 4 messages in the third stream
• Assuming that
— Each message fits into 1 data chunk
— Messages in the first stream are delivered first, then
• Data chunk is identified by three items: TSN, SI, and SSN
those in the second and third streams respectively
• TSN is a cumulative number identifying the association
— Cumulative in all streams
— Use for flow and error control
• SI defines the stream
89 • SSN defines the chunk order within a stream 90

SCTP Acknowledgement
Figure 23.31 SCTP packet format

• Acknowledgement number are chunk-oriented

— Referring to TSN
• Control chunk is acknowledged by another
corresponding control chunk
— Some control chunks need no acknowledgement
In SCTP, acknowledgment numbers are used to
acknowledge only data chunks;
control chunks are acknowledged by other control
chunks if necessary.
In an SCTP packet, control chunks come before data

91 92
Table 23.5 Chunks
Figure 23.32 General header

• Verification tag is a number that matches packet

to an association
— Prevent packets from previous association from
— Also serves as an identifier for the association

A connection in SCTP is called an association

to emphasize multihoming capability.
93 94

Figure 23.33 Four-way handshaking

SCTP Cookie
SCTP Association • Prevent SYNC flood attack in TCP
Establishment • Postpone resource allocation until the reception
of the third packet
— IP address of the sender is verified in the 3rd packet
— Cookie is used to save information until this step
• Cookie is generated with two sets of information
— Information from the sender
— Unique signature (or digest) of the first packet
• Usually base on secret key that only the creator will know
• If the same cookie is received in the third
packet, IP address of the requester would
No other chunk is allowed in A COOKIE ECHO or a
a packet carrying an INIT or COOKIE ACK chunk can
already been verified
INIT ACK chunk carry data chunks. 95 96
SCTP Data Transfer
Figure 23.34 Simple data transfer

• SCTP recognize and maintain message boundary

— Unlike TCP
— Each message is treated as one unit and inserted into
one or more DATA chunk In SCTP, only DATA
• Depending if fragmentation is required (message size exceeds chunks consume
path MTU) TSNs;
• Each chunk has its own TSN DATA chunks are the
only chunks that are
— Unlike UDP, relationship between DATA chunk is also acknowledged.
• Acknowledgement is based on the last in-order The acknowledgment
in SCTP defines the
TSN received cumulative TSN, the
— And not the next expected segment as in TCP TSN of the last data
chunk received in
— Selective ACK (SACK) is only transmitted once
97 98

Figure 23.35 Association termination

SCTP Flow Control
• Still bases on byte-oriented window like TCP
• Receiver maintains three variables
— cumTSN holds the last TSN received
• To be used in SACK transmission to the sender
— winSize holds available buffer size
• To be announced to the sender
— lastACK hold the last cumulative acknowledgement transmitted
• To decide if a new SACK should be sent
• Sender maintains three variables
— curTSN refers to the next chunk to be sent
— Rwnd holds the last announced receiver winSize value
— inTransit refers to bytes sent but not yet acknowledged
• SCTP does not allow a half-close situation

99 100
Figure 23.36 Flow control, receiver site Figure 23.37 Flow control, sender site

• New chunk pointed to by curTSN can be sent if

that chunk is not greater than rwnd – inTransit
• Assuming that one chunk = 100 bytes — curTSN and inTransit values are updated after
• Data received -> update winSize & cumTSN transmission
• Data delivered to process -> update winSize • inTransit and rwnd values are updated after
• SACK sent -> update lastACK and announce SACK is received
cumTSN & winSize 101 102

Figure 23.38 Flow control scenario Figure 23.39 Error control, receiver site

• Duplicate messages are discarded

— But such information is tracked and reported to sender
• An array of variables keep track of out-of-order block
— The beginning and end of each out-of-order block
• Receiver state will be reported in SACK chunk
103 104
Figure 23.40 Error control, sender site

• Need two queues, sending and retransmission

— Retransmission queue is transmitted before regular queue
• Retransmission timer is started after each packet
transmission 105