transmission control protocol (tcp) – part two · pdf filetransmission control protocol...
TRANSCRIPT
1©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200311
Chapter 12
Transmission Control Protocol(TCP) – Part Two
2©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200322
CONTENTS
Part Two
7. Retransmission Timer8. Congestion Control 9. Segment10. Options11. Checksum12. Connection13. State Transition Diagram14. TCP Oeration15. TCP Package
Part One
1. Process-to-process Communication
2. TCP Services3. Numbering Bytes4. Flow Control5. Silly Window Syndrome6. Error Control7. TCP Timers
3©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200333
12.7 TCP Timers
Missing ACK 0-Sized
WindowDetect Idle
clients Connection Termination
4©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200344
12.7.1 Retransmission Timer
How long to wait for an ACK of a previously sent segment before retransmission.Depends on distance and network traffic density.
Retransmission time should be dynamic.Retransmission time = 2 × RTT
Dynamic Calculation of RTT:Use a timestamp TCP option (discussed later), or
a) Actually measure RTT of first two segments of a connectionb) RTT new estimate = α × RTT old estimate + ( 1 – α ) × RTTactual
c) Typically, α = 0.90d) Do NOT consider retransmitted segments into the above
calculation of RTT
5©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200355
12.8 Congestion Control
Congestion occurs when some routers along the path run out of buffers and drop packets.Sending TCP assumes that a missing ACK is due to congestion.
Retransmission will only aggravate the congestionA Congestion Window (CongWin) is used to control number of segments transmitted simultaneously (i.e. before waiting for an ACK)
Sender Window = Min ( RecvWin , CongWin)
During connection establishment, each party specifies its maximum Receiving Window (RecvWinMax), and the Maximum Segment Size (MSS) it can receive.
6©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200366
The (Slow Start, Additive Increase, Multiplicative Decrease) Cycle
Received ACKs
Initially,CongWin = Receiver’s MSS = NThreshold = ½ RecvWinMax
Slow: CongWin = 2 × CongWinAdditive: CongWin = 1 + CongWinIf time-out,
Threshold = ½ CongWinCongWin = N
≤ RecvWin
7©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200377
12.9 TCP Segment20 to 60 Bytes
Starting from ISN
+ 2
Sliding Window
sizeIn Bytes
6 Control Bits
#of 4-Byte words Offset of
last byte of urgent data
8©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200388
Control Fields
Enable flow control, connection establishment & termination, andmode of data transfer.One or more bits may be set at the same timeDiscussed in detail later
9©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200399
12.10 Options
Up to 40 bytes of optional information to the destination
10©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031010
No-operation Option
A Filler option used for alignment purposes only.
11©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031111
End-of-option Option
Used as a padding to terminate options. Only ONE may be present.The remainder of this 32-bit word is garbage
Payload data starts at the next 32-bit word.
12©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031212
Maximum segment size (MSS) Option
The maximum number of data bytes I can receive in one segmentEach party determines its MSS during connection establishment
Cannot be changed later.Defaults to 536 bytes
13©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031313
Window scale factor Option
The 16-bit Window Size in the header is too small for high-speed links (e.g. OC-24 @ 1.2Gbps)Actual Sender Window size = WinSize in header × 2 WinScaleFactor
WinScaleFactor ≤ 16This option may only appear during connection establishment.
Header.WinSize may change, but WinScaleFactor is constant throughout the entire connection
14©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031414
Timestamp Option
Set by the sender just before the segment leaves (to IP layer)Echoed by the receiver just before it ACKs the segmentThe sender measure RTT as:
the arrival time of the ACK - the timestamp echo reply.
15©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031515
12.11 Checksum
Same as in UDP, but mandatory
16©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031616
12.12 Connection
Connections must be established to facilitate acknowledgements, and retransmissions.Connections are terminated at the end.A connection may be reset at any time in one of these 3 cases:1. A destination rests a connection requested for a nonexistent port2. One party encounters abnormal situation, so it resets the
connection3. One party detects that the other party has been idle for too long.
17©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031717
Connection Establishment: A 3-way Handshaking
Client Server
ISNPossibly MSS and/or
WinScaleFactor
WinSize, ISNPossibly MSS and/or
WinScaleFactor
WinSize,Possibly real data
LISTENingState
18©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031818
Connection Termination: A 4-way handshakingUsually, Client Usually, Server
Active Close
Passive Close
19©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031919
12.13 TCP FSM: State Transition Diagram
Client states Server states
20©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032020
Complete State Diagram
21©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032121
12.14 TCP Operation
Encapsulation and decapsulationBufferingMultiplexing and demultiplexingPushing Data
Send NOW, deliver to server application ASAPUrgent Data
Delivered to other application out-of-order
22©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032222
Encapsulation and decapsulation
23©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032323
Multiplexing and demultiplexing
24©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032424
12.15 TCP Package
25©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032525
Transmission Control Blocks
of the Connection