Professional Documents
Culture Documents
TCP
-
TCP vs UDP
TCP
-
Transmission control
protocol
Slower than UDP
Reliable
Connection oriented
Provides flow control
and error control
TCP offers error
connection and
Guaranteed Delivery
Provides or sends
larger packets
Ordered message
delivery
UDP
-
Heavyweight-when the
segment arrives in the
wrong order, resend
requests have to be
sent, and all the out of
sequence parts have to
be put back together
If any segments are
lost, the receiver Will
send ACK to intimate
lost segments
connections etc
No Acknowledgement
1 The client TCP, after receiving a close command from the client
process, sends the first segment, a FIN segment. The FIN
segment consumes one sequence number(x)
2 The server TCP, after receiving the FIN segment, informs its
process of the situation and sends the second segment, a FIN
+ACK segment, to confirm the receipt of the FIN segment from
the client and at the same time to announce the closing of the
connection in the other direction. The FIN +ACK segment
consumes one sequence number(y)
3 The client TCP sends the last segment, an ACK segment, to
confirm the receipt of the FIN segment from the TCP server. This
segment contains the acknowledgment number(y+1), which is 1
plus the sequence number received in the FIN segment from the
server.
TCPs State Transition Diagram
TCP uses a finite state machine to keep track of all the events
happening during the connection establishment, termination and data
transfer. The following figure shows that.
State
Description
CLOSED
No connection
LISTEN
SYN-SENT
SYN-RECD
ESTABLISHE
D
A connection is established
FIN-WAIT1
The application
connection
has
requested
the
closing
FIN-WAIT2
accepted
the
closing
TIME-WAIT
CLOSE-WAIT
LAST-ACK
Client program
The client program can be in one of the following states:
CLOSED, SYS-SENT, ESTABLISHED, FIN-WAIT1, FIN-WAIT2
and TIME-WAIT
1 The client TCP starts at CLOSED-STATE
2 The client TCP can receive an active open request from the client
application program. It sends SYN segment to the server TCP
and goes to the SYN-SENT state.
3 While in this state, the client TCP can receive a SYN+ACK
segment from the other TCP and goes to the ESTABLISHED
state. This is data transfer state. The client remains in this state
as long as sending and receiving data.
4 While in this state, the client can receive a close request from
the client application program. It sends FIN segment to the other
TCP and goes to FIN-WAIT1 state.
5 While in this state, the client TCP waits to receive an ACK from
the server TCP. When the ACK is received, it goes to the FINWAITE2 state. It does not send any thing. Now the connection is
closed in one direction.
6 The client remains in this state, waiting for the server TCP to
close the connection from the other end. If the client TCP
receives FIN segment from the other end, it sends an ACK and
goes to TIME-WAIT state.
7 When the client in this state, it starts time waited timer and
waits until this timer goes off. After the time out the client goes
to CLOSED state.
Server program
The server program can be in one of the following states:
CLOSED, LISTEN, SYN-RECD, ESTABLISHED, CLOSE-WAIT,
LAST-ACK
1 The server TCP starts in the CLOSED-STATE.
2 While in this state, the server TCP can receive a passive open
request from the server application program. It goes to LISTEN
state.
3 While in this state, the server TCP can receive a SYN segment
from the client TCP. It sends a SYN+ACK segment to the client
TCP and goes to the SYN-RECD state.
4 While in this state, the server TCP can receive ACK segment
from the client TCP. Then it goes to ESTABLISHED state. This is
data transfer state. The sender remains this state as long as it is
receiving and sending data.
5 While in this state, the server TCP can receive a FIN segment
from the client, which means that the client wishes to close the
connection. It can send an ACK segment to the client and goes
to the CLOSE-WAIT state.
6 While in this state, the server waits until it receives a close
request from the server application program. It then sends a FIN
segment to the client and goes to LAST-ACK state.
7 While in this state, the server waits for the last ACK segment. If
then goes to the CLOSED state.
TCP Flow control
Persistence timer: When the sender receives the ACK with a window
size zero, it starts the persistence timer. When it goes off, the sender
sends special segment called probe. The probe is an alert that alerts
the receiver that the ACK was lost and should be resent.
Keep alive timer: is used to prevent a long idle connection between
sender and receiver
Time waited timer: is used during the connection termination
Adaptive Retransmission
1.
2.
Karn/Partridge Algorithm
3.
Jacobson/Karels Algorithm
This
provides
exponential
growth(2^0,
and so on)
o
2^1,
Slow
start
cannot
continue indefinitely.
There
must
be
threshold to stop this
phase.
When
the
window size reaches
this threshold, slow
start stops and the
next phase starts.
an
a) DECbit
Queue length
Current
time
T
ime
Previous
Current
cycle
cycle
veraging
A
interval
The router sets the congestion bit if average queue length > 1
The router attempts to balance throughout against delay
The algorithm uses a threshold of 50%. If less than 50% of the
ACKs for a connection show the congestion bit to be set we
increase the CongestionWindow setting by 1.
Once more than 50% of the ACKs have the congestion bit set
we decrease the Congestion Window by .85.times the previous
value.
To summarize it,
If AvgLen is lower than some lower threshold, congestion is
assumed to be minimal or non-existent and the packet is
queued.
If AvgLen is greater than some upper threshold, congestion is
assumed to be serious and the packet is discarded.
If AvgLen is between the two thresholds, this might indicate the
onset of congestion. The probability of congestion is then
calculated.
c) TCP Vegas
TCP Vegas was the nickname used for the next version of the TCP/IP
UNIX stack. These approaches are host-centric. The basis of the
technique is:
Compare the current RTT with the current window size:
(CurrentWindow OldWindow)X(CurrentRTT-OldRTT)
When this value is greater than zero assume congestion is approaching
and incrementally decrease the window. When the value is negative or
zero values, incrementally increase the window size
Scheduling
If the average arrival rate is > the average processing rate, the queue
will fill up and new packets will be discarded.
Traffic Shaping
b) Token bucket
- It sends
bursty amount of data
In this algorithm leaky bucket
holds
token,
generated
at
regular intervals.
Steps:
1 In regular intervals tokens
are
thrown
into
the
bucket. The bucket has a
maximum capacity.
The two techniques can be combined to credit an idle host and at the same
time regulate
the traffic.
3.
Admission control
First approach is once the congestion has been signaled, do not set-up
new connections, once the congestion is signaled. This type of
approach is often used in normal telephone networks. When the
exchange is overloaded, then no new calls are established.
Resource Reservation
This means that if we want to use IntServ at the IP level, we need to create
a flow, a kind of virtual-circuit network, out of the IP, which was originally
designed as a datagram packet-switched network. A virtual-circuit network
needs a signaling system to set up the virtual circuit before data traffic can
start. The resource reservation protocol (RSVP) is a signaling protocol to
help IP create a flow and consequently make a resource reservation. RSVP
Messages
RSVP has two types of messages: Path and Resv.
Path Messages
In Receiver Based Reservation, the receivers, not the sender, make the
reservation. However, the receivers do not know the path traveled by
packets before the reservation is made. The path is needed for the
reservation. To solve the problem, RSVP uses Path messages. A Path
message travels from the sender and reaches all receivers in the multicast
path. On the way, a Path message stores the necessary information for the
receivers. A Path message is sent in a multicast environment; a new
message is created when the path diverges. The following figure shows path
messages.
Reservation Styles
When there is more than one flow, the router needs to make a reservation to
accommodate
all of them. RSVP defines three types of reservation styles, as shown in the
following figure
Wild Card Filter Style In this style, the router creates a single reservation for
all senders. The reservation is based on the largest request. This type of
style is used when the flows from different senders do not occur at the same
time.
Fixed Filter Style In this style, the router creates a distinct reservation for
each flow. This means that if there are n flows, n different reservations are
made. This type of style is used when there is a high probability that flows
from different senders will occur at the same time.
Shared Explicit Style In this style, the router creates a single reservation
which can be shared by a set of flows.
Soft State
The reservation information (state) stored in every node for a flow needs to
be refreshed periodically. This is referred to as a soft state. The default
interval for refreshing is currently 30 s.
Problems with Integrated Services
There are at least two problems with Integrated Services that may prevent
its full implementation in the Internet: scalability and service-type limitation.
1 Scalability
The Integrated Services model requires that each router keep
information for each flow. As the Internet is growing every day, this is
a serious problem.
2 Service-Type Limitation
The Integrated Services model provides only two types of services,
guaranteed and control-load. Those opposing this model argue that
applications may need more than these two types of services.
DIFFERENTIATED SERVICES
Differentiated Services (DS or Diffserv) was introduced by the IETF (Internet
Engineering Task Force) to handle the shortcomings of Integrated Services.
Two fundamental changes were made:
1.
of
to
of
The main processing was moved from the core of the network to the edge
the network. This solves the scalability problem. The routers do not have
store information about flows. The applications, or hosts, define the type
service they need each time they send a packet.
2. The per-flow service is changed to per-class service. The router routes the
packet based on the class of service defined in the packet, not the flow. This
solves the service-type limitation problem. We can define different types of
classes based on the needs of applications.
Differentiated Services is a class-based QoS model designed for IP.
DS Field
In Diffserv, each packet contains a field called the DS field. The value of this
field is set at the boundary of the network by the host or the first router
designated as the boundary router.
The DS field contains two subfields: DSCP and CU.
Per-Hop Behavior
The Diffserv model defines per-hop behaviors (PHBs) for each node that
receives a packet. There are two PHBs are defined:
a EF PHB
b AF PHB.