25
1 ©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl , 2003 1 1 Chapter 12 Transmission Control Protocol (TCP) – Part Two

Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

Embed Size (px)

Citation preview

Page 1: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

1©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200311

Chapter 12

Transmission Control Protocol(TCP) – Part Two

Page 2: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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

Page 3: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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

Page 4: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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

Page 5: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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.

Page 6: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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

Page 7: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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

Page 8: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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

Page 9: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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

Page 10: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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.

Page 11: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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.

Page 12: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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

Page 13: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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

Page 14: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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.

Page 15: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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

Page 16: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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.

Page 17: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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

Page 18: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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

Page 19: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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

Page 20: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

20©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032020

Complete State Diagram

Page 21: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

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

Page 22: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

22©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032222

Encapsulation and decapsulation

Page 23: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

23©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032323

Multiplexing and demultiplexing

Page 24: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

24©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032424

12.15 TCP Package

Page 25: Transmission Control Protocol (TCP) – Part Two · PDF fileTransmission Control Protocol (TCP) – Part Two. 2 ... Transmission Control Blocks of the Connection. Title: PowerPoint

25©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032525

Transmission Control Blocks

of the Connection