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

Transport Layer Protocols Overview

Uploaded by

yogidhasoban
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)
16 views32 pages

Transport Layer Protocols Overview

Uploaded by

yogidhasoban
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

Data Communication and Networking

UNIT-IV TRANSPORT LAYER


Introduction – Transport Layer Protocols – Services – Port Numbers – User
Datagram Protocol – Transmission Control Protocol – SCTP.
Introduction

Position of transport-layer protocols in the TCP/IP protocol suite


Services
Each protocol provides a different type of service and should be used
appropriately.

UDP
UDP is an unreliable connectionless transport-layer protocol used for its simplicity
andefficiency in applications where error control can be provided by the
application-layerprocess.

TCP
TCP is a reliable connection-oriented protocol that can be used in any
applicationwhere reliability is important.

SCTP
SCTP is a new transport-layer protocol that combines the features of UDP and
TCP.
Port Numbers
1. A transport-layer protocol creates a process-to-process communication.
2. These protocols use port numbers to accomplish this.
3. Port numbers provide end- to-end addresses at the transport layer and allow
multiplexing and demultiplexing at this layer.

Some well-known ports used with UDP and TCP

USER DATAGRAM PROTOCOL


• The User Datagram Protocol (UDP) is a connectionless, unreliable transport
protocol.
• It provides process-to-processcommunication instead of host-to-host
communication.
• UDP is avery simple protocol using a minimum of overhead.
• If a process wants to send a smallmessage without conidering reliability, it
can use UDP.
• Sending a small messageusing UDP takes much less interaction between the
sender and receiver than usingTCP.
User Datagram
• UDP packets are called user datagrams.
• They have a fixed-size header of 8 bytes made of fourfields, each of 2 bytes
(16 bits).

Format of a user datagram.


• First two fields define the source and destination port numbers.
• The third field definesthe total length of the user datagram, header plus
data(0 to 65,535 bytes)
• The lastfield has the optional checksum

UDP Services
1. Process-to-Process Communication
2. Connectionless Services
3. Flow Control
4. Error Control
5. Congestion Control
6. Encapsulation and Decapsulation
7. Queuing
8. Multiplexing and Demultiplexing

1. Process-to-Process Communication
 UDP provides process-to-process communication using socket addresses.
2. Connectionless Services
• UDP provides a connectionless service.
• Eachuser datagram sent by UDP is an independent datagram.
• The user datagrams are not numbered.
• There is no connection establishment and no connection termination.
• Each user datagram can travel on a different path.
• One of the ramifications of being connectionless is that the process that uses
• Only those processes sending short messages, messages less than65,507
bytes (65,535 minus 8 bytes for the UDP header and minus 20 bytes for the
IP header), can use UDP.
3. Flow Control
• There is no flow control, and hence no window mechanism.
• The receiver may overflow with incoming messages.
4. Error Control
• There is no error control mechanism in UDP except for the checksum.
• Sender does not know if a message has been lost or duplicated.
• When the receiverdetects an error through the checksum, the user datagram
is silently discarded.
 Checksum
o UDP checksum calculationincludes three sections:

▪ pseudoheader ▪ UDP header


▪ data coming from theapplication layer.
o If the checksum does not include the pseudoheader, a user datagram
may arrive safe.
o If the IP header is corrupted, it may be delivered to the wrong host.
o The protocol field is added to ensure that the packet belongs to UDP,
and not toTCP. o The value of the protocol field for UDP is 17. If this
value ischanged during transmission, the checksum calculation at the
receiver will detect it andUDP drops the packet.

Pseudoheader for checksum calculation


5. Congestion Control
• UDP does not provide congestion control.
• UDPassumes that the packets sent are small and cannot create congestion
inthe network.

6. Encapsulation and Decapsulation


 To send a message from one process to another, the UDP protocol
encapsulates anddecapsulates messages.

7. Queuing
• InUDP, queues are associated with ports.
• At the client site, when a process starts, it requests a port number from the
operatingsystem.
• Some implementations create both an incoming and an outgoing
queueassociated with each process. Other implementations create only an
incoming queueassociated with each process.

8. Multiplexing and Demultiplexing


• Severalprocesses may want to use the services of UDP.
• To handle this situation, UDP multiplexesand demultiplexes.

UDP Applications
1. UDP is suitable for a process that requires simple request-response
communication.
Note: It is not usually used for a processsuch as FTP that needs to send bulk
data .
2. UDP is suitable for a process with internal flow- and error-control
mechanisms.
For example, the Trivial File Transfer Protocol (TFTP) process includes
flow anderror control.
3. UDP is a suitable transport protocol for multicasting. Multicasting capability
isembedded in the UDP software but not in the TCP software.
4. UDP is used for management processes such as SNMP(Simple Network
Management Protocol)
5. UDP is used for some route updating protocols such as Routing Information
Protocol(RIP)
6. UDP is normally used for interactive real-time applications that cannot
tolerateuneven delay between sections of a received message.
TRANSMISSION CONTROL PROTOCOL(TCP)
• Transmission Control Protocol (TCP) is a connection-oriented, reliable
protocol.
• It defines connection establishment, data transfer, and connection
teardownphases to provide a connection-oriented service.
• TCP uses a combination ofGBN and SR protocols to provide reliability.
• TCP is the most commontransport-layer protocol in the Internet.
TCP Services 1. Process-to-Process Communication
 As with UDP, TCP provides process-to-process communication using
port numbers.
2. Stream Delivery Service
• TCPis a stream-oriented protocol.
• TCPallows the sending process to deliver data as a stream ofbytes and
allows the receiving process to obtain data as a stream of bytes.
• The sending process produces (writes to) the stream and thereceiving
process consumes (reads from) it.

Stream Delivery Sending and Receiving Buffers


• At the sender, the bufferhas three types of chambers:
1. empty chambers that can befilled by the sending process (producer).
2. Chambers that hold bytes that have beensent but not yet
acknowledged.
• Chambers that contain bytes to be sent by the sendingTCP.
• The operation of the buffer at the receiver is simpler.
• The circular buffer is dividedinto two types of chambers:
1. Empty chambersto be filled by bytes received from the network.
2. Chambers that contain receivedbytes that can be read by the
receiving process.
• When a byte is read by the receivingprocess, the chamber is recycled
and added to the pool of empty chambers.
Sending and Receiving Buffers

Segments

• TCP groups a number of bytes together into a packet called a segment.


• TCP adds a header to each segment (for control purposes) and delivers
the segment to thenetwork layer for transmission.
• The segments are encapsulated in an IP datagram andtransmitted.
• Segments are not of the same size.
• Full-Duplex Communication- TCP offers full-duplex service, where
data can flow in both directions at the same time.
• Multiplexing and Demultiplexing- TCP performs multiplexing at the
sender and demultiplexing at the receiver.
• Connection-Oriented Service - TCP is a connection-oriented protocol,
a connection needs to be established for each pair of processes.
1. The two TCP’s establish a logical connection between them.
2. Data are exchanged in both directions.
3. The connection is terminated.
• Reliable Service -TCP is a reliable transport protocol. It uses an
acknowledgment mechanism to checkthe arrival of data.

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 ifthere are no options and up to 60 bytes if it
contains options.

1. Source port address -This is a 16-bit field that defines the port number of
theapplication program in the host that is sending the segment.
2. Destination port address - This is a 16-bit field that defines the port
number of theapplication program in the host that is receiving the segment.
3. Sequence number- This 32-bit field defines the number assigned to the first
byte ofdata contained in this segment.
4. Acknowledgment number- This 32-bit field defines the byte number that
thereceiver of the segment is expecting to receive from the other party.
5. Header length - This 4-bit field indicates the number of 4-byte words in the
TCPheader. The length of the header can be between 20 and 60 bytes.
6. Control - This field defines 6 different control bits or [Link] bits enable
flow control, connectionestablishment and termination, connection abortion,
and the mode of datatransfer in TCP.

7. Window size - This field defines the window size of the sending TCP in
bytes. Maximum size of thewindow is 65,535 bytes.
8. Checksum - This 16-bit field contains the checksum.
9. Urgent pointer - This 16-bit field, which is valid only if the urgent flag is
set, isused when the segment contains urgent data.
10. Options- There can be up to 40 bytes of optional information in the TCP
header.

TCP Connection Establishment


• TCP establishes a logical path between the source and destination.
• This requires three phases:
1. Connection establishment
2. Data transfer
3. Connection termination.
• The connection establishment in TCP is called three-way handshaking.
• The three-way handshake involves the exchange of three messages between
the client and the server.
1. First, the client (the active participant) sends a segment to the server (the
passive participant) stating the initial sequence number it plans to use (Flags
= SYN, SequenceNum = x).
2. The server then responds with a single segment that both acknowledges the
client’s sequence number (Flags = ACK, Ack = x + 1) and states its own
beginning sequence number (Flags = SYN, SequenceNum = y). That is, both
the SYN and ACK bits are set in the Flags field of this second message.
3. Finally, the client responds with a third segment that acknowledges the
server’s sequence number (Flags = ACK, Ack = y + 1).
TCP Connection Termination
 Three-way handshaking is also used for connection termination.
1. The client TCP, after receiving a close command from the client process,
sends the first segment, a FIN segment in which the FIN flag is set.
2. The server TCP, after receiving the FIN segment, sends the second segment,
a FIN + ACK segment, to confirm the receipt of theFIN segment from the
client and at the same time to announce the closing of the connectionin the
other direction.
3. The client TCP sends the last segment, an ACK segment, to confirm the
receipt ofthe FIN segment from the TCP server.
TCP State Transition Diagram

• This diagram shows only the states involved in opening a connection


(everything above ESTABLISHED) and in closing a connection (everything
below ESTABLISHED). Everything that goes on while a connection is
open—that is, the operation of the sliding window algorithm—is hidden in
the ESTABLISHED state.
• Each circle denotes a state that one end of a TCP connection can find itself
in.
• All connections start in the CLOSED state.
• Each arc is labeled with a tag of the form event/action.
• Thus, if a connection is in the LISTEN state and a SYN segment arrives
(i.e., a segment with the SYN flag set), the connection makes a transition to
the SYN RCVD state and takes the action of replying with an ACK + SYN
segment.
• When opening a connection, the server first invokes a passive open
operation on TCP, which causes TCP to move to the LISTEN state.
• At some later time, the client does an active open, which causes its end of
the connection to send a SYN segment to the server and to move to the
SYN SENT state.
• When the SYN segment arrives at the server, it moves to the SYN RCVD
state and responds with a SYN+ACK segment.
• The arrival of this segment causes the client to move to the ESTABLISHED
state and to send an ACK back to the server.


When this ACK arrives, the server finally moves to the ESTABLISHED
state. In other words, we have just traced the three-way handshake.
• Now to the process of terminating a connection, the important thing to keep
in mind is that the application process on both sides of the connection must
independently close its half of the connection.
• If only one side closes the connection, then this means it has no more data
to send, but it is still available to receive data from the other side.
• Thus, on any one side there are three combinations of transitions that get a
connection from the ESTABLISHED state to the CLOSED state: ■ This
side closes first:
ESTABLISHED → FIN WAIT 1 → FIN WAIT 2 → TIME WAIT →
CLOSED.
■ The other side closes first:
ESTABLISHED → CLOSE WAIT → LAST ACK → CLOSED.
■ Both sides close at the same time:
ESTABLISHED → FIN WAIT 1 → CLOSING → TIME WAIT → CLOSED.
Flow Control
• Flow control balances the rate a producer creates data with the rate a
consumer can use the data.
• Assume that the logical channel between the sending and receiving TCP is
error-free.
• Paths 1, 2, and 3 - The data travel from the sending process down to the
sending TCP, from the sending TCP to the receiving TCP, and from the
receiving TCP up to the receiving process.
• Paths 4 and 5- Flow control feedbacks, are traveling from the receiving
TCP to the sending TCP and from the sending TCP up to thesending
process.

Opening and Closing Windows


• To achieve flow control, TCP forces the sender and the receiver to adjust
their windowsizes.
• The receive window closes (moves its left wall to the right) when morebytes
arrive from the sender; it opens (moves its right wall to the right) when more
 bytes are pulled by the process.
• The opening, closing, and shrinking of the send window is controlled by
thereceiver.
• The send window closes (moves its left wall to the right) when a
newacknowledgment allows it to do so.
• The send window opens (its right wall moves to theright) when the receive
window size (rwnd) advertised by the receiver allows it to do so newackNo
+ new rwnd> last ackNo + last rwnd
• The send window shrinks in theevent this situation does not occur.


Shrinking of Windows
 The receive window cannot shrink.
The send window, on the otherhand, can shrink if the receiver defines a
value for rwnd that results in shrinking thewindow.
newackNo 1 new rwnd ≥ last ackNo 1 last rwnd

Error Control
• TCP is a reliable transport-layer protocol. This means that an application
program thatdelivers a stream of data to TCP relies on TCP to deliver the
entire stream to the applicationprogram on the other end in order, without
error, and without any part lost orduplicated.
• TCP provides reliability using error control.
• Error control includes mechanisms fordetecting and resending corrupted
segments, resending lost segments, storing out-ofordersegments until
missing segments arrive, and detecting and discarding duplicatedsegments.
• Error control in TCP is achieved through the use of three simple tools:
1. Checksum
2. Acknowledgment
3. time-out.
Checksum
• Each segment includes a checksum field, which is used to check for a
corrupted segment.
• If a segment is corrupted, as detected by an invalid checksum, the segment is
discardedby the destination TCP and is considered as lost.
• TCP uses a 16-bit checksumthat is mandatory in every segment.
Acknowledgment
• TCP uses acknowledgments to confirm the receipt of data segments.
• Control segmentsthat carry no data, but consume a sequence number, are
also acknowledged.
• ACK segmentsare never acknowledged.
• Acknowledgment Type
1. Cumulative Acknowledgment (ACK) - TCP acknowledges receipt of
segments cumulatively. The receiver advertises the next byte it
expects toreceive, ignoring all segments received and stored out of
order.
• Selective Acknowledgment (SACK) - A SACKreports a block of bytes that
is out of order, and also a block of bytes that is duplicated,
Generating Acknowledgments
1. When end A sends a data segment to end B, it must include (piggyback) an
acknowledgment that gives the next sequence number it expects to receive.
2. The receiver needs to delay sending an ACK segment if there is only
oneoutstandingin-order segment.
3. When a segment arrives with a sequence number that is expected by the
receiver,and the previous in-order segment has not been acknowledged, the
receiver immediatelysends an ACK segment.
4. When a segment arrives with an out-of-order sequence number that is
higher thanexpected, the receiver immediately sends an ACK segment
announcing thesequence number of the next expected segment.
5. When a missing segment arrives, the receiver sends an ACK segment to
announcethe next sequence number expected.
6. If a duplicate segment arrives, the receiver discards the segment, but
immediatelysends an acknowledgment indicating the next in-order segment
expected.

TCP Congestion Control

• The idea of TCP congestion control is for each source to determine how
much capacity is available in the network, so that it knows how many
packets it can safely have in transit.
• Once a given source has this many packets in transit, it uses the arrival of
an ACK as a signal that one of its packets has left the network, and that it
is therefore safe to insert a new packet into the network without adding to
the level of congestion.
• By using ACKs to pace the transmission of packets, TCP is said to be
self-clocking.

Congestion Control Mechanisms

1. Additive Increase/Multiplicative Decrease

• TCP maintains a new state variable for each connection, called


CongestionWindow.
• Congestion Window is used by the source to limit how much data it is
allowed to have in transit at a given time.


• The congestion window is congestion control’s counterpart to flow control’s
advertised window.
• TCP is modified such that the maximum number of bytes of
unacknowledged data allowed is now the minimum of the congestion
window and the advertised window.
Effective window is revised as follows:
MaxWindow = MIN(CongestionWindow, AdvertisedWindow)
EffectiveWindow = MaxWindow−
(LastByteSent−LastByteAcked).

• That is, MaxWindow replaces AdvertisedWindow in the calculation of


EffectiveWindow.
• Thus, a TCP source is allowed to send no faster than the slowest
component—the network or the destination host—can accommodate.
• The AdvertisedWindow, is sent by the receiving side of the connection.

How does TCP set a value for congestion window?


• The TCP source sets the CongestionWindow based on the level of
congestion it perceives to exist in the network.
• This involves decreasing the congestion window when the level of
congestion goes up and increasing the congestion window when the level of
congestion goes down.
• This mechanism is commonly called additive increase/multiplicative
decrease (AIMD).

How does the source determine that the network is congested and that it
should decrease the congestion window?
• TCP interprets timeouts as a sign of congestion and reduces the rate at which
it is transmitting.
• Specifically, each time a timeout occurs, the source sets CongestionWindow
to half of its previous value.
• This halving of the CongestionWindow for each timeout corresponds to the
―multiplicative decreaseǁ part of AIMD.
• Although CongestionWindow is defined in terms of bytes, it is easiest to
understand multiplicative decrease if we think in terms of whole packets.
• For example, suppose the CongestionWindow is currently set to 16 packets.
If a loss is detected, CongestionWindow is set to 8.
• Additional losses cause CongestionWindow to be reduced to 4, then 2, and
finally to 1 packet.
• CongestionWindow is not allowed to fall below the size of a single packet,
or in TCP terminology, the maximum segment size (MSS).
• We also need to be able to increase the congestion window to take advantage
of newly available capacity in the network.
• This is the ―additive increaseǁ part of AIMD, and it works as follows.
• Every time the source successfully sends a CongestionWindow’s worth of
packets—that is, each packet sent out during the last RTT has been
ACKed—it adds the equivalent of one packet to CongestionWindow.
• This linear increase is illustrated in Figure .
• Specifically, the congestion window is incremented as follows each time an
ACK arrives:
Increment = MSS × (MSS/CongestionWindow)
CongestionWindow + = Increment


Packets in transit during additive increase, with one packet being
added each RTT.
[Type here]

Typical TCP sawtooth pattern

The above graph is a plot of the current value of congestion window as a


function of time.

2. Slow Start

• The additive increase mechanism is used when the source is operating


close to the available capacity of the network.
• It takes too long to ramp up a new TCP connection.

Packets in transit during slow start.


• Slow start is used to increase the congestion window rapidly from a cold
start.
• Slow start effectively increases the congestion window exponentially,
rather than linearly.
• Specifically, the source starts out by setting CongestionWindow to one
packet.
• When the ACK for this packet arrives, TCP adds 1 to
CongestionWindow and then sends two packets.
• Upon receiving the corresponding two ACKs, TCP increments
CongestionWindow by 2—one for each ACK—and next sends four
packets.
• The end result is that TCP effectively doubles the number of packets it
has in transit every RTT.
• The above figure shows the growth in the number of packets in transit
during slow start.
Why is it called slow start?

• If the source sends as many packets as the advertised window allows, the
routers may not be able to consume this burst of packets.
• It all depends on how much buffer space is available at the routers.
• Slow start was therefore designed to space packets out so that this burst
does not occur.
• Thus slow start is much ―slowerǁ than sending an entire advertised
window’s worth of data all at once.

Situations under which slow start is used


• There are actually two different situations in which slow start runs.
1. For a new connection
In this situation, slow start continues to double Congestion Window
each RTT until there is a loss, at which time a timeout causes
multiplicative decrease to divide Congestion Window by 2.

2. When connection goes dead waiting for a timeout to occur In this


situation, when a packet is lost, the source eventually reaches a point
where it has sent as much data as the advertised window allows, and
so it blocks while waiting for an ACK that will not arrive. Eventually,
a timeout happens, but by this time there are no packets in transit.
[Type here]

• From the above graph, Congestion Window flattens out at about 34 KB.
• The reason why the congestion window flattens is that there are no ACKs
arriving,
• due to the fact that several packets were lost.
• When a timeout eventually happens, the congestion window is divided
by 2 (i.e., cut from approximately 34 KB to around 17 KB) and
Congestion Threshold is set to this value.
• Congestion Window is reset to one packet and slow start is used till
Congestion Window reaches Congestion Threshold, after which
Congestion Window increases linearly.

3. Fast Retransmit and Fast Recovery

• Fast retransmit is a heuristic that sometimes triggers the retransmission of


a dropped packet sooner than the regular timeout mechanism.
• The fast retransmit mechanism does not replace regular timeouts; it just
enhances that facility.
• Every time a data packet arrives at the receiving side, the receiver responds
with an acknowledgment, even if this sequence number has already been
acknowledged.
• Thus, when a packet arrives out of order— that is, TCP cannot yet
acknowledge the data the packet contains because earlier data has not yet
arrived—TCP resends the same acknowledgment it sent the last time.
• This second transmission of the same acknowledgment is called a duplicate
ACK.
• When the sending side sees a duplicate ACK, it knows that the other side
must have received a packet out of order, which suggests that an earlier
packet might have been lost.
• Since it is also possible that the earlier packet has only been delayed rather
than lost, the sender waits until it sees some number of duplicate ACKs and
then retransmits the missing packet.
• In practice, TCP waits until it has seen three duplicate ACKs before
retransmitting the packet.
• Figure illustrates how duplicate ACKs leads to a fast retransmit.
• In this example, the destination receives packets 1 and 2, but packet 3 is lost
in the network.
• Thus, the destination will send a duplicate ACK for packet 2 when packet 4
arrives, again when packet 5 arrives, and so on.
• When the sender sees the third duplicate ACK for packet 2—the one sent
because the receiver had gotten packet 6—it retransmits packet 3.
• Note that when the retransmitted copy of packet 3 arrives at the destination,
the receiver then sends a cumulative ACK for everything up to and including
packet 6 back to the source.
• When the fast retransmit mechanism signals congestion, it is possible to use
the ACKs that are still in the pipe to clock the sending of packets.
• This mechanism, which is called fast recovery, effectively removes the slow
start phase that happens between when fast retransmit detects a lost packet
and additive increase begins.
[Type here]

Fast retransmit based on duplicate ACKs.

• For example, fast recovery avoids the slow start and instead simply cuts the
congestion window in half and resumes additive increase.
• In other words, slow start is only used at the beginning of a connection.
• At all other times, the congestion window is following a pure additive
increase/multiplicative decrease pattern.

TCP Timers
 To perform their operations smoothly, most TCP implementations use at
least four timers:
1. Retransmission
2. Persistence
3. Keepalive
4. TIME-WAIT.
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.
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, andrestarts the timer.
3. When a segment or segments are cumulatively acknowledged, the
segment or segmentsare purged from the queue.
4. If the queue is empty, TCP stops the timer; otherwise, TCP restarts the
timer.
Persistence Timer
• To deal with a zero-window-size advertisement, TCP needs another timer.
• If the receiving TCP announces a window size of zero, the sending TCP
stops transmitting segments until the receiving TCP sends an ACK segment
announcing a nonzero window size.
• This ACK segment can be lost.
• If this acknowledgment is lost, the receiving TCP thinks that it has done its
job and waits for the sending TCP to send more segments.
• There is no retransmission timer for a segment containing only an
acknowledgment.
• The sending TCP has not received an acknowledgment and waits for the
other TCP to send an acknowledgment advertising the size of the window.
• Both TCP’s might continue to wait for each other forever (a deadlock).
• To correct this 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.
• The probe causes the receiving TCP to resend the acknowledgment.
• The value of the persistence timer is set to the value of the retransmission
time.
• However, if a response is not received from the receiver, another probe
segment is sentand the value of the persistence timer is doubled and reset.
[Type here]

• The sender continues sendingthe probe segments and doubling and resetting
the value of the persistence timeruntil the value reaches a threshold (usually
60 s).
• After that the sender sends one probesegment every 60 seconds until the
window is reopened.
Keepalive Timer
 A keepalive timer is used to prevent a long idle connection between two
TCPs.
Example:Suppose that a client opens a TCP connection to a server,
transferssome data, and has crashed. In this case, the connection remains
open forever. The server has a keepalive timer. Each time the server hears
from a client, it resets this timer. The time-out is usually 2 hours. If the
server does not hear from the client after 2 hours, it sends a probe segment.
If there is no response after 10 probes, each of which is 75 seconds apart, it
assumes that the client is down and terminates the connection.
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.
• Common values for MSL 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.

SCTP(Stream Control Transmission Protocol)


• (SCTP) is a new transport-layer protocol designed to combine some features
of UDP and TCP in an effort to create a better protocol for multimedia
communication.
SCTP Services 1. Process-to-Process Communication
• SCTP, like UDP or TCP, provides process-to-process communication.
2. Multiple Streams
• SCTP allows multistream service in each connection.
• If one of the streams is blocked, the other streams can still delivertheir data.
3. Multihoming
• The sending and receiving host can define multiple IP addresses in each end
for an association.
• In this fault-tolerant approach, when one path fails, another interface can be
used for data delivery without interruption.
• This fault-tolerant feature is very helpful when we are sending and receiving
a real-time payload such as Internet telephony.

4. Full-Duplex Communication
• SCTP offers full-duplex service, where data can flow in both directions at
the same time.
• Each SCTP then has a sending and receiving buffer and packets are sentin
both directions.
5. Connection-Oriented Service
 SCTP is a connection-oriented protocol.
6. Reliable Service
• SCTP is a reliable transport protocol.
• It uses an acknowledgment mechanism to check the arrival of data.

SCTP Features
1. Transmission Sequence Number (TSN)
 The unit of data in SCTP is a data chunk.
• Data transfer in SCTP is controlled by numbering the data chunks.
• SCTP uses a transmission sequence number (TSN) to number the data
chunks.
[Type here]

• TSNs are 32 bits long and randomly initialized between 0 and 232 − 1. 
Each data chunkmust carry the corresponding TSN in its header.
2. Stream Identifier (SI)
• There may be several streams in each association.
• Each stream in SCTP needsto be identified using a stream identifier (SI).
• Each data chunk must carry the SI in itsheader so that when it arrives at the
destination, it can be properly placed in its stream.
• The SI is a 16-bit number starting from 0.
3. Stream Sequence Number (SSN)
• When a data chunk arrives at the destination SCTP, it is delivered to the
appropriatestream and in the proper order.
• This means that, in addition to an SI, SCTP defines eachdata chunk in each
stream with a stream sequence number (SSN).
4. Packets
• Data are carried as data chunks, control information as controlchunks.
• Several control chunks and data chunks can be packed together in a packet.
• Apacket in SCTP plays the same role as a segment in TCP.

5. Acknowledgment Number
• SCTP acknowledgment numbers are chunk-oriented.
• In SCTP, the control information is carried by control chunks, which do
notneed a TSN.
• These control chunks are acknowledged by another control chunk of the
appropriate type (some need no acknowledgment).
Packet Format

General Header

SCTP Association Establishment

Association establishment in SCTP requires a four-way handshake.


1. The client sends the first packet, which contains an INIT chunk. The
verificationtag (VT) of this packet is 0 because no verificationtag has yet
been defined for this direction (client to server). The INIT tag includesan
initiation tag to be used for packets from the other direction (server to
client).The chunk also defines the initial TSN for this direction and
[Type here]

advertises a value forrwnd. The value of rwnd is normally advertised in a


SACK chunk.
2. The server sends the second packet, which contains an INIT ACK chunk.
The verificationtag is the value of the initial tag field in the INIT chunk. This
chunk initiatesthe tag to be used in the other direction, defines the initial
TSN, for data flowfrom server to client, and sets the server’s rwnd. The
value of rwnd is defined toallow the client to send a DATA chunk with the
third packet. The INIT ACK alsosends a cookie that defines the state of the
server at this moment.
3. The client sends the third packet, which includes a COOKIE ECHO chunk.
This isa very simple chunk that echoes, without change, the cookie sent by
the [Link] allows the inclusion of data chunks in this packet.
4. The server sends the fourth packet, which includes the COOKIE ACK chunk
thatacknowledges the receipt of the COOKIE ECHO chunk. SCTP allows
the inclusionof data chunks with this packet.

SCTP Association Termination

Flow Control Receiver Site


• The receiver has one buffer (queue) and three variables.
• The queue holds the receiveddata chunks that have not yet been read by the
process.
• The first variable holds the lastTSN received,cumTSN. The second variable
holds the available buffer size, winSize.
• The third variable holds the last cumulative acknowledgment, lastACK.
1. When the site receives a data chunk, it stores it at the end of the buffer
(queue) andsubtracts the size of the chunk from winSize. The TSN number
of the chunk isstored in the cumTSN variable.
2. When the process reads a chunk, it removes it from the queue and adds the
size ofthe removed chunk to winSize (recycling).
3. When the receiver decides to send a SACK, it checks the value of lastAck; if
it isless than cumTSN, it sends a SACK with a cumulative TSN number
equal to thecumTSN. It also includes the value of winSize as the advertised
window size. Thevalue of lastACK is then updated to hold the value of
cumTSN. Sender Site

• The sender has one buffer (queue) and three variables: curTSN, rwnd, and
inTransit,
[Type here]

• curTSN, refers to the next chunk to be sent.


• rwnd, holds the last value advertised by the receiver(in bytes).
• inTransit, holds the number of bytes in transit, bytes sentbut not yet
acknowledged.
1. A chunk pointed to by curTSN can be sent if the size of the data is
less than orequal to the quantity (rwnd − inTransit). After sending the
chunk, the value ofcurTSN is incremented by one and now points to
the next chunk to be sent. Thevalue of inTransit is incremented by the
size of the data in the transmitted chunk.
2. When a SACK is received, the chunks with a TSN less than or equal
to the cumulativeTSN in the SACK are removed from the queue and
discarded. The value of inTransit is reduced bythe total size of the
discarded chunks. The value of rwnd is updated with the valueof the
advertised window in the SACK.

Error Control Receiver Site

• The receiver stores all chunks that have arrived in its queue includingthe out-of-
order ones.
• The last acknowledgment sent was for data chunk 20.
• The available window size is1000 bytes.
• Chunks 21 to 23 have been received in order.
• The first out-of-order blockcontains chunks 26 to 28.
• The second out-of-order block contains chunks 31 to 34.
• Avariable holds the value of cumTSN.
• An array of variables keeps track of the beginningand the end of each block that
is out of order.
• An array of variables holds the duplicatechunks received.
Sender Site

• At the sender site, our design demands two buffers (queues): a sending queue
and aretransmission queue.
• We also use three variables: rwnd, inTransit, and curTSN.
• The sending queue holds chunks 23 to 40.
• The chunks 23 to 36 have alreadybeen sent, but not acknowledged; they are
outstanding chunks.
• The curTSN points tothe next chunk to be sent (37).
• We assume that each chunk is 100 bytes, which meansthat 1400 bytes of data
(chunks 23 to 36) are in transit.
• The sender at this moment hasa retransmission queue.
• When a packet is sent, a retransmission timer starts for thatpacket.
• When theretransmission timer for a packet expires, or three SACKs arrive that
declares a packetas missing, the chunks in that packet aremoved to
theretransmission queue to be resent.
• These chunks are considered lost,rather than outstanding.
• The chunks in the retransmission queue have priority.
• Inother words, the next time the sender sends a chunk, it would be chunk 21
from theretransmission queue.

You might also like