data communication networks (graduate level) transport...

67
Department of Computer and IT Engineering University of Kurdistan Data Communication Networks (Graduate level) Transport Layer By: Dr. Alireza Abdollahpouri

Upload: others

Post on 17-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Department of Computer and IT Engineering

University of Kurdistan

Data Communication Networks (Graduate level)

Transport Layer

By: Dr. Alireza Abdollahpouri

Page 2: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

2

TCP/IP protocol suite

Page 3: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

The transport layer is responsible

for process-to-process delivery.

Transport Layer

3

Page 4: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

� provide logical communication between application processes running on different hosts

� transport protocols run in end systems

� sending side: breaks app messages into segments, passes to network layer

� receiving side: reassembles segments into messages, passes to application layer

� more than one transport protocol available to applications.

� Internet: TCP and UDP

network

data link

physical

Logical end to end transport

Transport Layer

application transport network data link physical

application transport network data link physical

4

Page 5: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Ht

Message

application Ha Message

transport

Ht Ht Ht

network

App. Process decides to send a message to its counterpart

App. Layer adds its header, sends the message to transport layer

Transport layer breaks down the message into several parts,

add its header to each part And makes segments.

It sends one-by-one segments to network layer

Protocol layering and data

App. Process

5

Page 6: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Port numbers

6

Page 7: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

IP addresses versus port numbers

7

Page 8: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

IANA ranges for port numbers

8

Page 9: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Socket address

9

Page 10: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Multiplexing and demultiplexing

10

Page 11: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

11

TCP/IP protocol suite

Page 12: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

UDP is a connectionless, unreliable

protocol that has no flow and error

control. It uses port numbers to

multiplex data from the application

layer.

UDP

12

Page 13: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Some Well-known ports used by UDP

Port Protocol Description

13 Daytime Returns the date and the time

17 Quote Returns a quote of the day

53 Nameserver Domain Name Service

67 Bootps Server port to download bootstrap information

68 Bootpc Client port to download bootstrap information

69 TFTP Trivial File Transfer Protocol

111 RPC Remote Procedure Call

123 NTP Network Time Protocol

161 SNMP Simple Network Management Protocol

13

Page 14: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

User datagram format

The calculation of checksum and its inclusion in

the user datagram are optional.

14

Page 15: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Popular Applications That Use UDP

� Multimedia streaming

� Retransmitting lost/corrupted packets is not

worthwhile

� By the time the packet is retransmitted, it’s too late

� E.g., telephone calls, video conferencing, gaming

� Simple query protocols like Domain Name System

� Overhead of connection establishment is overkill

� Easier to have the application retransmit if needed

“Address for www.cnn.com?”

“12.3.4.15” 15

Page 16: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

16

TCP/IP protocol suite

Page 17: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Transmission Control Protocol (TCP)

� Connection oriented

� Explicit set-up and tear-down of TCP session

� Stream-of-bytes service

� Sends and receives a stream of bytes, not messages

� Reliable, in-order delivery

� Checksums to detect corrupted data

� Acknowledgments & retransmissions for reliable delivery

� Sequence numbers to detect losses and reorder data

� Flow control

� Prevent overflow of the receiver’s buffer space

� Congestion control

� Adapt to network congestion for the greater good

17

Page 18: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

18

Stream delivery

محيطي را فراهم مي آورد كه گويي دو پروسه به وسيله يك لوله فرضي به همديگر متصل شده اند

TCP محيطي را فراهم مي آورد كه گويي دو پروسه به وسيله يك لوله فرضي به همديگر متصل شده اند

Page 19: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

19

Sending and receiving buffers

در دو طرف فرستنده و گيرنده يك بافر براي ارسال و دريافت داردTCP در دو طرف فرستنده و گيرنده يك بافر براي ارسال و دريافت دارد

Page 20: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

20

TCP segments

جرياني از بايتها را در قالب سگمنت ها ارسال مي كند اليه باالتر چيزي در موردسگمنتها و محدوده آنها نميداند

TCPجرياني از بايتها را در قالب سگمنت ها ارسال مي كند اليه باالتر چيزي در موردسگمنتها و محدوده آنها نميداند

1. Write 100 bytes 2. Write 20 bytes

1. Read 40 bytes 2. Read 40 bytes 3. Read 40 bytes

Page 21: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

21

The bytes of data being transferred in

each connection are numbered by TCP.

The numbering starts with a randomly

generated number.

Note:

Page 22: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

22

Suppose a TCP connection is transferring a file of 5000

bytes. The first byte is numbered 10001. What are the

sequence numbers for each segment if data is sent in five

segments, each carrying 1000 bytes?

Example of Byte numbering and sequence numbers

Solution

The following shows the sequence number for each segment:

Segment 1 ➡➡➡➡ Sequence Number: 10,001 (range: 10,001 to 11,000)

Segment 2 ➡➡➡➡ Sequence Number: 11,001 (range: 11,001 to 12,000)

Segment 3 ➡➡➡➡ Sequence Number: 12,001 (range: 12,001 to 13,000)

Segment 4 ➡➡➡➡ Sequence Number: 13,001 (range: 13,001 to 14,000)

Segment 5 ➡➡➡➡ Sequence Number: 14,001 (range: 14,001 to 15,000)

Page 23: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

23

The value in the sequence number

field of a segment defines the number

of the first data byte contained

in that segment.

Note:

Page 24: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

24

The value of the acknowledgment field

in a segment defines the number of the

next byte a party expects to receive.

The acknowledgment number is

cumulative.

Note:

Page 25: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

TCP

IP

Applications

23 10480Ports:

TCP

IP

Applications

7 1680 Ports:

A pair <IP address, port number> identifies one endpoint of a

connection. Two pairs <client IP address, server port number> and <server IP address, server port number> identify a TCP

connection.

49123

TCP connection

25

Page 26: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Seq

=001

Seq

=1001

Seq

=2001

Seq

=3001

Seq

=4001

Seq

=5001

Byte

data

1 2 … 1001 … 2001 … 3001 … 4001 … 5001…

Data is broken into 6 1000-Byte-segments.

TCP Header

26

Page 27: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

27

TCP Header

شماره ترتيب اولين بايتي كه در قسمت داده قرار

دارد

شماره ترتيب بايتي كه منتظر دريافت آن است

20

Byte

s

Page 28: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

28

TCP Header

4طول هدر بر حسب كلمه بايتي

Page 29: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

29

TCP Header

مورد -اندازه پنجره دريافت استفاده در مكانيسم كنترل جريان

اين فيلد به عنوان يك اشاره گر موقعيت داده هاي اضطراري را

درون سگمنت معين ميكند

Page 30: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

TCP Header - Urgent Data Pointer

• Last byte of urgent data (LBUD) = sequenceNumber +

urgentPointer

• First byte of urgent data never explicitly defined

• Any data in Receive buffer up to LBUD may be

considered urgent

urgent data pointer

sequence number

Received byte stream, stored in Receive Buffer

seq. num + urg. ptr = Last Byte of Urgent Data

urgent data

Received TCP segment

non-urgent data

30

Page 31: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

31

I

Description of flags in the control field

براي برقراري و قطع اتصال استفاده مي شوند ACKو FINو SYNبيتهاي براي برقراري و قطع اتصال استفاده مي شوند و و بيتهاي

Page 32: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

32

Connection establishment using “three-way handshaking”

A SYN segment cannot carry data, but it consumes

one sequence number.

Page 33: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

33

A SYN + ACK segment cannot carry

data, but does consume one

sequence number.

Note:

An ACK segment, if carrying no

data, consumes no sequence number.

Page 34: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

34

Data transfer

Page 35: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

35

Connection termination

The FIN and (FIN+ACK) segments consume one sequence number if

they do not carry data.

Page 36: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

36

States for TCP

Page 37: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

TCP states

TCP client lifecycle

TCP server lifecycle

Used in case ACK gets lost. It is implementation-dependent (e.g. 30

seconds, 1 minute, 2 minutes

Connection formally closes – all resources (e.g. port numbers) are

released

1

2

3

4

5

6

7

8

9

10

11

12

37

Page 38: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

TCP flow control and congestion control

38

Page 39: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

39

TCP Flow Control

1 2 3 4 5 6 7 8 9 10 11

Advertised window

sent but not

acknowledged can be sent

USABLE

WINDOW

sent and

acknowledged

can't sent

.استفاده ميكند» پنجره لغزان«براي كنترل جريان از مكانيزم TCP .استفاده ميكند» پنجره لغزان«براي كنترل جريان از مكانيزم

Page 40: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

1 2 3 4 5 6 7 8 9 10 11

1 2 3 4 5 6 7 8 9 10 11

Transmit Byte 6

1 2 3 4 5 6 7 8 9 10 11

AckNo = 5, Win = 4

is received

• Transmission of a single byte (with SeqNo = 6) and acknowledgement is received (AckNo = 5, Win=4):

TCP Flow Control

گيرنده فرستنده

40

Page 41: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

1 2 3 4 5 6 7 8 9 10 11

1 2 3 4 5 6 7 8 9 10 11

AckNo = 5, Win = 6

is received

• Acknowledgement is received that enlarges the window to the right (AckNo = 5, Win=6):

TCP Flow Control

41

Page 42: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Sliding Window: Example

3K

2K SeqNo=0

Receiver

Buffer

0 4KSender

sends 2K

of data

2K

AckNo=2048 Win=2048

Sender

sends 2K

of data 2K SeqNo=20484K

AckNo=4096 Win=0

AckNo=4096 Win=1024

Se

nd

er b

locke

d

42

Page 43: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

43

Page 44: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

44 acknowledged sent to be sent outside window

Source Port Dest. Port

Sequence Number

Acknowledgment

HL/Flags Window

D. Checksum Urgent Pointer

Options…

Source Port Dest. Port

Sequence Number

Acknowledgment

HL/Flags Window

D. Checksum Urgent Pointer

Options...

Segment Sent Segment Received

App write

Window Flow Control: Sender Side

Page 45: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Sliding Window Protocols

Go Back n از بسته خراب شده به بعد مجددا ارسال شوند

Selective Repeat فقط بسته خراب شده مجددا ارسال شود

در مورد اين پروتكلها و تحليل كارايي آنها در اليه پيوند داده توضيح داده شده است در مورد اين پروتكلها و تحليل كارايي آنها در اليه پيوند داده توضيح داده شده است

مشابه پروتكلهاي كنترل جريان در اليه پيوند داده

45

Page 46: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

� TCP limit sending rate as a function of perceived network

congestion

� little traffic – increase sending rate

� much traffic – reduce sending rate

� Congestion algorithm has three major “components”:

� additive-increase, multiplicative-decrease (AIMD)

� slow-start

� reaction to timeout events

TCP Congestion Control

46

Page 47: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Network Conceptual Model

We don’t know when sources will start/end their sessions; also their datarates are variable

Many sources and many receivers …

NetworkNetworkNetworkNetwork

(a)

47

Page 48: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Simplified Network Model

The entire network is abstracted as a single router – “black box”

(b)

Network resources Represented by “Congestion Window Size”

Receiver resources Represented by

“Receive Window Size”

48

Page 49: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

49

Router queues

اگرنرخ ورودي بسته ها، از سرعت پردازش بسته ها در داخل مسيرياب بيشتر .باشد، صفهاي ورودي طوالني خواهند شد

اگرنرخ حركت بسته ها در صفهاي خروجي كمتر از نرخ پردازش آنها باشد، .صفهاي خروجي طوالني خواهند شد

.در صورت پر شدن بافر، مسيرياب مجبور به دور ريختن بسته ميشود

Page 50: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

50

در اين حالت بسته ها به مقصد . هنگامي كه بار بيش از ظرفيت ميگردد، تاخير به سمت بينهايت ميروداز طرف ديگر، فرستنده بسته ها نيز به دليل اينكه پيام . نميرسند و صفها طوالني و طوالنيتر خواهند شد

تصديقي از جانب گيرنده دريافت نميكند، اقدام به ارسال مجدد بسته ها نموده و به بدتر شدن شرايط .كمك مينمايد

Page 51: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Queue

Sink Outbound Link Router Inbound Link

Sink

TCP

TCP AQM

TCP in action

Queue

Sink Outbound Link Router Inbound Link

Sink

TCP

TCP

ACK…

ACK…

Queue

Sink Outbound Link Router Inbound Link

Sink

TCP

TCP

ACK…

ACK…

Queue

Sink Outbound Link Router Inbound Link

Sink

TCP

TCP

ACK…

Drop!!!

Queue

Sink Outbound Link Router Inbound Link

Sink

TCP

TCP

Congestion Notification…

ACK…

51

Page 52: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

52

Slow start, exponential increase

Page 53: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

AAAA BBBBcwnd=cwnd=cwnd=cwnd=1111cwnd=cwnd=cwnd=cwnd=2222cwnd=cwnd=cwnd=cwnd=3333cwnd=cwnd=cwnd=cwnd=4444cwnd=cwnd=cwnd=cwnd=5555cwnd=cwnd=cwnd=cwnd=6666cwnd=cwnd=cwnd=cwnd=8888cwnd=cwnd=cwnd=cwnd=7777cwnd=cwnd=cwnd=cwnd=9999cwnd=cwnd=cwnd=cwnd=16161616

SN=SN=SN=SN=1111SN=SN=SN=SN=101101101101A=A=A=A=101101101101SN=SN=SN=SN=201201201201

Slow Start

AAAA BBBBcwnd=cwnd=cwnd=cwnd=1111cwnd=cwnd=cwnd=cwnd=2222cwnd=cwnd=cwnd=cwnd=3333cwnd=cwnd=cwnd=cwnd=4444cwnd=cwnd=cwnd=cwnd=5555cwnd=cwnd=cwnd=cwnd=6666cwnd=cwnd=cwnd=cwnd=8888cwnd=cwnd=cwnd=cwnd=7777cwnd=cwnd=cwnd=cwnd=9999cwnd=cwnd=cwnd=cwnd=16161616

SN=SN=SN=SN=1111SN=SN=SN=SN=101101101101A=A=A=A=101101101101SN=SN=SN=SN=20120120120120202020

15151515

0000

10101010

1111 2222 3333 4444

5555

....

....

....

....

....

CWND/rtt

� If CWND is less than or equal to SSTHRESTH : Slow start

� Slow start dictates that CWND start at one segment, and be incremented by one segment every time an ACK is received

AAAA BBBBcwnd=cwnd=cwnd=cwnd=1111cwnd=cwnd=cwnd=cwnd=2222cwnd=cwnd=cwnd=cwnd=3333cwnd=cwnd=cwnd=cwnd=4444cwnd=cwnd=cwnd=cwnd=5555cwnd=cwnd=cwnd=cwnd=6666cwnd=cwnd=cwnd=cwnd=8888cwnd=cwnd=cwnd=cwnd=7777cwnd=cwnd=cwnd=cwnd=9999cwnd=cwnd=cwnd=cwnd=16161616

SN=SN=SN=SN=1111SN=SN=SN=SN=101101101101A=A=A=A=101101101101SN=SN=SN=SN=201201201201AAAA BBBBcwnd=cwnd=cwnd=cwnd=1111cwnd=cwnd=cwnd=cwnd=2222cwnd=cwnd=cwnd=cwnd=3333cwnd=cwnd=cwnd=cwnd=4444cwnd=cwnd=cwnd=cwnd=5555cwnd=cwnd=cwnd=cwnd=6666cwnd=cwnd=cwnd=cwnd=8888cwnd=cwnd=cwnd=cwnd=7777cwnd=cwnd=cwnd=cwnd=9999cwnd=cwnd=cwnd=cwnd=16161616

SN=SN=SN=SN=1111SN=SN=SN=SN=101101101101A=A=A=A=101101101101SN=SN=SN=SN=201201201201

53

Page 54: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

54

In the slow start algorithm, the size

of the congestion window increases

exponentially until it reaches a

threshold.

Note:

Page 55: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

55

Additive increase

Page 56: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

56

In the congestion avoidance

algorithm the size of the congestion

window increases additively until

congestion is detected.

Note:

Page 57: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

57

Most implementations react differently to

congestion detection:

❏❏❏❏ If detection is by time-out, a new slow start phase starts.

❏❏❏❏ If detection is by three ACKs, a new congestion avoidance phase starts.

Note:

Page 58: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

58

Congestion Control example

Page 59: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

TCP Congestion Control

16

8

4

2

1

sent packets per round

(congestion window)

time

40

20

10

5

80

15

30

25

35

75

55

45

50

65

60

70

Losing a single packet (TCP Tahoe): � threshold drops to halve CONGESTION WINDOW � CONGESTION WINDOW back to 1

Losing a single packet (TCP Reno): � threshold drops to halve CONGESTION WINDOW � CONGESTION WINDOW back to new threshold

ssthresh

ssthresh

50%

59

Page 60: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

60

TCP Behavior

W

RTT

1

2

3

4

5

6

7

8

Calculate “average packet loss rate” and “average

throughput”

Page 61: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

TCP Round Trip Time and Timeout

Q: how to set TCP

timeout value?

� longer than RTT

� but RTT varies

� too short: premature timeout

� unnecessary retransmissions

� too long: slow reaction to segment loss

Q: how to estimate RTT? � SampleRTT: measured time from

segment transmission until ACK receipt

� ignore retransmissions

� SampleRTT will vary, want

estimated RTT “smoother”

� average several recent measurements, not just current SampleRTT

61

Page 62: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

TCP timer management

Data link layer Transport layer

62

Page 63: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

TCP Round Trip Time and Timeout

EstimatedRTT = (1- αααα)*EstimatedRTT + αααα*SampleRTT

r typical value: αααα = 0.125 RTT: gaia.cs.umass.edu to fantasia.eurecom.fr

100

150

200

250

300

350

1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106

time (seconnds)

RT

T (

mil

lisec

on

ds)

SampleRTT Estimated RTT

63

Page 64: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

TCP Round Trip Time and Timeout

Setting the timeout

� EstimatedRTT plus “safety margin”

� large variation in EstimatedRTT -> larger safety margin

� first estimate of how much SampleRTT deviates from EstimatedRTT:

TimeoutInterval = EstimatedRTT + 4*DevRTT

DevRTT = (1-ββββ)*DevRTT +ββββ*|SampleRTT-EstimatedRTT|

(typically, ββββ = 0.25)

Then set timeout interval:

64

Page 65: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Fairness goal: if K TCP sessions share same

bottleneck link of bandwidth R, each should have

average rate of R/K

TCP connection 1

bottleneck router

capacity R

TCP connection 2

TCP Fairness

65

Page 66: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

Why is TCP fair?

Two competing sessions:

� Additive increase gives slope of 1, as throughout increases

� multiplicative decrease decreases throughput proportionally

R

R

equal bandwidth share

Connection 1 throughput

congestion avoidance: additive increase

loss: decrease window by factor of 2

congestion avoidance: additive increase loss: decrease window by factor of 2

66

Page 67: Data Communication Networks (Graduate level) Transport Layereng.uok.ac.ir/abdollahpouri/Data_Communication/Lecture6_Transpor… · Multimedia streaming Retransmitting lost/corrupted

67

Questions Questions