BCSE308L_Module 6 (1)
BCSE308L_Module 6 (1)
Functionalities:
It facilitates the communicating hosts to carry on a
conversation.
It provides an interface for the users to the underlying
network.
It can provide for a reliable connection. It can also carry out
error checking, flow control, and verification.
Flags(1-bit each) :
URG- It indicates that Urgent Pointer field has significant data
and should be processed.
ACK- It indicates that Acknowledgement field has
significance. If ACK is cleared to 0, it indicates that packet
does not contain any acknowledgement.
PSH- When set, it is a request to the receiving station to
PUSH data (as soon as it comes) to the receiving
application without buffering it.
RST- Reset flag has the following features:
• It is used to refuse an incoming
connection.
• It is used to reject a segment.
• It is used to restart a connection.
SYN- This flag is used to set up a
connection between hosts.
FIN- This flag is used to release a connection and no more data
is exchanged thereafter. Because packets with SYN and FIN
flags have sequence numbers, they areandprocessed
Data Communictions Networking26 in correct
TCP Header...
Windows Size- This field is used for flow control between two
stations and indicates the amount of buffer (in bytes) the
receiver has allocated for a segment,
Checksum- This field contains the checksum of Header, Data
and Pseudo Headers.
Urgent Pointer- It points to the urgent data byte if URG flag is
set to 1
Options- It facilitates additional options which are not
covered by the regular header. Option field is always
described in 32-bit words. If this field contains data less than
32-bit, padding is used to cover the remaining bits to reach
32-bit boundary.
A SYNsegment
cannot carry
data, but it
consumes one
sequence
number.
A SYN +
ACKseqgment
can’t carry data,
but does
consume one
sequence
number.
AnACKsegment,
if carrying no
data,
consumes no
Data Communictions and Networking30
Data Transfer and Connection
Termination
Data Connection
transfer Termination
Keep-alive timer:
This timer is used to check the integrity and validity of a
connection. When keep-alive time expires, the host sends
a probe to check if the connection still exists.
Timed-Wait:
After releasing a connection, either of the hosts
waits for a Timed-Wait time to terminate the
connection completely.
This is in order to make sure that the other end has
received the acknowledgement of its connection
termination request.
Timed-out can be a maximum of 240 seconds (4
minutes).
Retransmission timer:
This timer maintains stateful session of data sent.
If the acknowledgement of sent data does not receive
within the Retransmission time, the data segment is sent
again.
Persist timer:
TCP session can be paused by either host by sending Window
Size 0. To resume the session a host needs to send Window
Size with some larger value.
If this segment never reaches the other end, both ends may
wait for each other for infinite time.
When the Persist timer expires, the host re-sends its window
size to let the other end know.
Persist Timer helps avoid deadlocks in communication.
Data Communictions and Networking46
Example
Solution
The value of rwnd = 5000 − 1000 = 4000. Host B can
receive only 4000 bytes of data before overflowing its
buffer. Host B advertises this value in its next segment to
A.
Example
Solution
The size of the window is the smaller of rwnd and cwnd,
which is 3000 bytes.
Crash Recovery
The hosts can then send the last data segment which
was never unacknowledged and carry onwards.
(Connectionless).
delivery of data.
UDP is stateless.
ConnectionLess Service:
UDP provides a connectionless service. This means that
each user datagram sent by UDP is an independent
datagram.
There is no relationship between the different user datagrams
even if they are coming from the same source process and
going to the same destination program.
The user datagrams are not numbered.
Flow Control:
UDP is a very simple protocol. There is no flow control, and
hence no window mechanism.
The receiver may overflow with incoming messages. The lack
of flow control means that the process using UDP should
provide for this service, if needed.
Error Control
There is no error control mechanism in UDP except for the
checksum. This means that the sender does not know if
a message has been lost or duplicated.
When the receiver detects an error through the
checksum, the user datagram is silently discarded.
The lack of error control means that the process using
UDP should provide for this service, if needed.
Check Sum:
UDP checksum calculation includes three sections: a
pseudoheader, the UDP header, and the data coming
from the application layer.
Checksum
Checksum.. Calculation
..!
TCP UDP
Connection-oriented Connectionless protocol.
protocol.
Messages contain packets
Reads data as streams of
bytes, and the message is that were sent one by
transmitted to segment one. It also checks for
boundaries. integrity at the arrival
time.
TCP messages make their It is not connection-based,
way so one program can
across the internet from send lots of packets
one computer to to another.
another.
UDP protocol has no fixed
TCP rearranges data order
packets in the specific
because all packets
order.
are independent of
each other.
UDP is faster as error
The speed for TCP is slower. recovery
Data Communictions and Networking61
TCP versus UDP
TCP UDP
TCP is heavy-weight.
UDP is lightweight.
TCP needs three packets to
No tracking
set up a socket connection
connections,
before
Ordering of
any user data can be sent.
messages, etc.
It does error checking and UDP performs error
also makes error recovery. checking,
but it discards erroneous
packets.
Acknowledgment segments No Acknowledgment
segments
Using handshake protocol No handshake
like SYN, SYN-ACK, ACK (so connectionless protocol)
TCP is reliable as it The delivery of data to the
guarantees destination can’t be
delivery of data to the guaranteed in UDP.
destination router.
It offers extensive error
UDP has just a single
Data Communictions and Networking62
Data Communictions and
Networking
Congestion Control and Quality of Service
Amount_of
Average_Data_Rate : Tim
_Data e
Constant-bit-rate(CBR),
or a fixed-rate - Data
rate that doesn’t
change.
Variable-bit-rate(VBR) -
the rate of the data
flow changes in time,
with the changes
smooth instead of
sudden and sharp.
Bursty Data rate- the
data rate changes
suddenly in a very
short time.
Congestion Control...
It refers to the mechanisms and techniques to control the
congestion and keep the load below the capacity.
In general, we can divide congestion control mechanisms
into two broad categories: open-loop congestion control
(prevention) and closed-loop congestion control (removal).
Window Policy:
The type of window at the sender may also affect congestion.
The Selective Repeat window is better than the Go-Back-N
window
for congestion control.
In the Go-Back-N window, when the timer for a packet times
out, several packets may be resent, although some may have
arrived safe and sound at the receiver. This duplication may
makethe congestion worse.
The Selective Repeat window, on the other hand, tries to
send the specific packets that have been lost or corrupted.
Acknowledgment Policy:
It imposed by the receiver, may also affect congestion.
If the receiver does not acknowledge every packet it receives, it
may slow down the sender and help prevent congestion.
A receiver may decide to acknowledge only N packets at a time.
We need to know that the acknowledgments are also part of
the load in a network. Sending fewer acknowledgments means
imposing less load on the network.
Discarding Policy:
A good discarding policy by the routers may prevent congestion
and at the same time may not harm the integrity of the
transmission.
For example, in audio transmission, if the policy is to discard
less sensitive packets when congestion is likely to happen, the
quality of sound is still preserved and congestion is prevented
or alleviated.
Admission Policy:
It is a QoS mechanism can also prevent congestion in
virtual-circuit networks.
Switches in a flow first check the resource requirement
of a flow before admitting it to the network.
A router can deny establishing a virtual-circuit
connection if there is congestion in the network or if
there is a possibility of
future congestion.
Choke Packets:
It is a packet sent by a node to the source to inform it of
congestion. When a router in the Internet is overwhelmed
with IP datagrams, it may discard some of them; but it
informs the source host, using a source quench
ICMP(Internet Control Message Protocol) message.
The warning message goes directly to the source station;
the intermediate routers, and does not take any action.
Choke
Packets:
The warning is from the router, which has encountered
congestion, to the source station directly. The inter-mediate
nodes through which the packet has traveled are not
warned.
Back Pressure:
The warning is from one node to its upstream node,
although the warning may eventually reach the source
station.
Implicit Signaling:
There is no communication b/w the congested node and
source. The source guesses that there is a congestion
somewhere in the network from other symptoms.
For Eg: when a source sends several packets and no
acknowledgment for a while, one assumption is that the
network is congested.
The delay in receiving an acknowledgment is interpreted
as congestion in the network; the source should slow down.
Explicit Signaling:
The node that experiences congestion can explicitly send a
signal to the source or destination.
In this method, however, is different from the choke packet
method.
In the choke packet method, a separate packet is used for this
purpose; In the explicit signaling method, the signal is included
in the packets that carry data.
It can occur in either the forward or the backward direction.
Data Communictions and Networking78
Closed-loop Congestion
Control
Backward Signaling:
A bit can be set in a packet moving in the direction
opposite to the congestion.
This bit can warn the source that there is congestion
and that it needs to slow down to avoid the discarding
of packets.
Forward Signaling:
A bit can be set in a packet moving in the
direction of the congestion.
This bit can warn the destination that there is
congestion.
The receiver in this case can use policies, such as slowing
down the acknowledgments, to alleviate the congestion
Slow-start phase,
The sender starts with a very slow rate of transmission, but
increases the rate rapidly to reach a threshold.
When the threshold is reached, the data rate is reduced to avoid
congestion.
Finally if congestion is detected, the sender goes back to the
slow-start or congestion avoidance phase based on how
the congestion is detected.
Data Communictions and Networking80
Slowstart - Exponential Increase
Figure:Slow Start
Phase
Data Communictions and Networking81
Congestion Avoidance - Additive
Increase
Figure:Congestion
Avoidance
Data Communictions and Networking83
Congestion Detection - Multiplicative
Decrease
The only way the sender can guess that congestion has
occurred is by the need to retransmit a segment. However,
retransmission can occur in one of two cases:
When a timer times out :
When three ACKs are received.
Implementation of Leaky
Bucket
2 Token
bucket :
Token Bucket
It allows bursty traffic at a regulated maximum rate.
Conclusion
The two techniques can be combined to credit an idle host
and at the same time regulate the traffic.
The leaky bucket is applied after the token bucket;
The rate of the leaky bucket needs to be higher than
the rate of tokens dropped in the bucket.