Chapter 3: roadmap
 Transport-layer services
 Multiplexing and demultiplexing
 Connectionless transport: UDP
 Principles of reliable data transfer
 Connection-oriented transport: TCP
• segment structure
• reliable data transfer
• flow control
• connection management
 Principles of congestion control
 TCP congestion control
Transport Layer: 3-1
TCP: overview RFCs: 793,1122, 2018, 5681, 7323
 cumulative ACKs
 pipelining:
• TCP congestion and flow control
set window size
 connection-oriented:
• handshaking (exchange of control
messages) initializes sender,
receiver state before data exchange
 flow controlled:
• sender will not overwhelm receiver
 point-to-point:
• one sender, one receiver
 reliable, in-order byte
stream:
• no “message boundaries"
 full duplex data:
• bi-directional data flow in
same connection
• MSS: maximum segment size
Transport Layer: 3-2
TCP segment structure
source port # dest port #
32 bits
not
used receive window flow control: # bytes
receiver willing to accept
sequence number
segment seq #: counting
bytes of data into bytestream
(not segments!)
application
data
(variable length)
data sent by
application into
TCP socket
A
acknowledgement number
ACK: seq # of next expected
byte; A bit: this is an ACK
options (variable
length)
TCP options
head
len
length (of TCP header)
checksum
Internet checksum
RST, SYN, FIN: connection
management
F
S
R
Urg data pointer
P
U
C E
C, E: congestion notification
Transport Layer: 3-3
RST: reset the connection
Syn: Synchronize the sequence number
FIN: Finish the connection
4
The 4-bit header length field:
•This specifies the length of the TCP header in 32-bit words
•The TCP header can be of variable length due to the TCP options field
•Typically, the options field is empty, so that the length of the typical TCP header is 20
bytes
- The flag field: contains 6 bits
•The ACK bit is used to indicate that the value carried in the acknowledgment field is
valid, that is, the segment contains an acknowledgment for a segment that has been
successfully received
•The RST, SYN, and FIN bits are used for connection setup and teardown
•Other flags are typically not used
5
Sequence Numbers and ACK Numbers
- As discussed earlier for RDT protocols, the sequence number and ACK number are
required for ensuring reliability
- But, TCP interprets the sequence and ACK numbers differently from our early
study of RDT protocols
- In RDT protocols discussed earlier, the sequence and ACK numbers are
interpreted to be the index of the data packet and the index of the data packet
being acknowledged, respectively
- But, TCP views the application data as an unstructured but ordered stream of
bytes rather than as a sequence of data packets
- TCP’s use of sequence numbers reflects this view
•That is the TCP sequence numbers are over the stream of transmitted bytes and not
over the series of transmitted segments
6
Thus the sequence number for a segment is therefore the byte-stream number of the
first byte in the segment;
for example
•Suppose that the data stream consists of a file consisting of 500,000 bytes, that the MSS is
1,000 bytes, and that the first byte of the data stream is numbered 0
•Then, TCP constructs 500 segments out of the data stream
•The first segment gets assigned sequence number 0, the second segment gets assigned
sequence number 1,000, the third segment gets assigned sequence number 2,000, and so
on
•Each sequence number is inserted in the sequence number field in the header of the
appropriate TCP segment
7
TCP is full-duplex, so that Host A may be receiving data from Host B while it sends data to Host B (as part
of the same TCP connection).
Host B to Host A
Each of the segments that arrive from Host B has a sequence number for the data flowing from B to A.
The acknowledgment number that Host A puts in its segment is the sequence number of the next byte
Host A is expecting from Host B.
Suppose that Host A has received all bytes numbered 0 through 535 from B and suppose that it is about
to send a segment to Host B. Host A is waiting for byte 536 and all the subsequent bytes in Host B’s data
stream. So Host A puts 536 in the acknowledgment number field of the segment it sends to B.
.
8
9
Host B to Host A
suppose that Host A has received one segment from Host B containing bytes 0 through 535 and another
segment containing bytes 900 through 1,000.
For some reason Host A has not yet received bytes 536 through 899.
In this example, Host A is still waiting for byte 536 (and beyond) in order to re-create B’s data stream.
Thus, A’s next segment to B will contain 536 in the acknowledgment number field.
Because TCP only acknowledges bytes up to the first missing byte in the stream, TCP is said to provide
cumulative acknowledgments.
10
Urgent Data
For example, if the segment sequence number is 15000 and the value of the urgent pointer is 200, the
first byte of urgent data is the byte 15000 and the last byte is the byte 15200. The rest of the bytes in the
segment (if present) are non-urgent.
TCP sequence numbers, ACKs
host ACKs receipt
of echoed ‘C’
host ACKs receipt of‘C’,
echoes back ‘C’
simple telnet scenario
Host B
Host A
User types‘C’
Seq=42, ACK=79, data = ‘C’
Seq=79, ACK=43, data = ‘C’
Seq=43, ACK=80
Transport Layer: 3-11
Telnet (short for "telecommunications network") is a
client/server application protocol that provides access to virtual
terminals of remote systems on local area networks or the
Internet.
12
suppose the starting sequence numbers are 42 and 79 for the client and server, respectively.
Recall that the sequence number of a segment is the sequence number of the first byte in the data field. Thus,
the first segment sent from the client will have sequence number 42; the first segment sent from the server will
have sequence number 79.
Recall that the acknowledgment number is the sequence number of the next byte of data that the host is
waiting for. After the TCP connection is established but before any data is sent, the client is waiting for byte 79
and the server is waiting for byte 42.
TCP round trip time, 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
Transport Layer: 3-13
the SampleRTT values will fluctuate from segment to segment due
to congestion in the routers and to the varying load on the end systems
TCP round trip time, timeout
EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT
 exponential weighted moving average (EWMA)
 influence of past sample decreases exponentially fast
 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)
RTT
(milliseconds)
SampleRTT Estimated RTT
RTT
(milliseconds)
RTT: gaia.cs.umass.edu to fantasia.eurecom.fr
sampleRTT
EstimatedRTT
time
(seconds) Transport Layer: 3-14
TCP sequence numbers, ACKs
Sequence numbers:
• byte stream “number” of
first byte in segment’s data
source port # dest port #
sequence number
acknowledgement number
checksum
rwnd
urg pointer
outgoing segment from receiver
A
sent
ACKed
sent, not-
yet ACKed
(“in-flight”)
usable
but not
yet sent
not
usable
window size
N
sender sequence number space
source port # dest port #
sequence number
acknowledgement number
checksum
rwnd
urg pointer
outgoing segment from sender
Acknowledgements:
• seq # of next byte expected
from other side
• cumulative ACK
Transport Layer: 3-15
TCP round trip time, timeout
 timeout interval: EstimatedRTT plus “safety margin”
• large variation in EstimatedRTT: want a larger safety margin
TimeoutInterval = EstimatedRTT + 4*DevRTT
estimated RTT “safety margin”
DevRTT = (1-)*DevRTT + *|SampleRTT-EstimatedRTT|
(typically,  = 0.25)
 DevRTT: EWMA of SampleRTT deviation from EstimatedRTT:
Transport Layer: 3-16
17
18
TCP maintains a single timer and sets the timeout value as
TimeoutInterval = EstimatedRTT + 4 *DevRTT
Think of the timer as being associated with the oldest unacknowledged segment
An initial TimeoutInterval value of 1 second is recommended when the connection is established; as
soon as a segment is received and EstimatedRTT is updated, the TimeoutInterval is computed using the
formula above
When a timeout occurs, the value of TimeoutInterval is doubled to avoid a premature timeout occurring
for a subsequent segment; as soon as a segment is received and EstimatedRTT is updated, the
TimeoutInterval is computed using the formula above
Similarly, if application layer data is received but no timer is already running (this could happen, for
example, when the application did not generate data for a sufficiently long time) then the
TimeoutInterval is computed using the formula above
19
A Simplified TCP Sender (uses only timeouts to recover from
lost segments)
- There are three major events related to data transmission
and retransmission in the simplified TCP sender:
•Data received from application above
•Timer timeout
•ACK receipt
20
- Data received from above
• TCP receives data from the application, encapsulates the data in
a segment, and passes the segment to IP
• Each segment includes a sequence number that is the byte-
stream number of the first data byte in the segment
• If the timer is already not running for some other segment, TCP
starts the timer when the segment is passed to IP and sets the
TimeoutInterval to a value that is calculated from EstimatedRTT
and DevRTT
- Timeout
TCP retransmits only the oldest unacknowledged segment and
then restarts the timer
21
Arrival of an ACK (i.e., a segment containing the ACK bit set)
• TCP compares the ACK value y with its variable SendBase
• The TCP state variable SendBase is the sequence number of
the oldest unacknowledged byte
• Thus SendBase - 1 is the sequence number of the last byte that
is known to have been received correctly and in order at the
receiver
• Since TCP uses cumulative acknowledgments, y acknowledges
the receipt of all bytes before byte number y
• If y > SendBase, then the ACK is acknowledging one or more
previously unacknowledged segments; then the sender
updates its SendBase variable; it also restarts the timer if there
are any not-yet-acknowledged segments
22
23
24
TCP fast retransmit
Host B
Host A
timeout
ACK=100
ACK=100
ACK=100
ACK=100
X
Seq=92, 8 bytes of data
Seq=100, 20 bytes of
data
Seq=100, 20 bytes of data
Receipt of three duplicate ACKs
indicates 3 segments received
after a missing segment – lost
segment is likely. So retransmit!
if sender receives 3 additional
ACKs for same data (“triple
duplicate ACKs”), resend unACKed
segment with smallest seq #
 likely that unACKed segment lost,
so don’t wait for timeout
TCP fast retransmit
Transport Layer: 3-25
26
Mid Term exam portion till this slide
27
Is TCP like Go-Back-N or Selective-Repeat?
• TCP’s error-recovery mechanism is probably best
categorized as a hybrid of GBN and SR protocols
• - Features like Go-Back-N
• TCP acknowledgments are cumulative and correctly
received but out-of-order segments are not individually
ACKed by the receiver
• TCP sender need only maintain the smallest sequence
number of a transmitted but unacknowledged byte
(SendBase) and the sequence number of the next byte to
be sent (NextSeqNum)
28
Book 2
29
Isn=initial sequence
number
30
Book 2
31
Book 2
32
33
Features like Selective-Repeat
• Many TCP implementations buffer correctly received but
out-of-order segments
• TCP retransmits only one segment when a timeout occurs
or triple-duplicate ACKs are recived, unlike Go-Back-N that
retransmits all outstanding segments
• A proposed modification to TCP, the so-called selective
acknowledgment [RFC 2018], allows a TCP receiver to
acknowledge out-of-order segments selectively rather than
just cumulatively acknowledging the last correctly received,
in-order segment
34
35
TCP 3-way handshake
SYNbit=1, Seq=x
choose init seq num, x
send TCP SYN msg
ESTAB
SYNbit=1, Seq=y
ACKbit=1; ACKnum=x+1
choose init seq num, y
send TCP SYNACK
msg, acking SYN
ACKbit=1, ACKnum=y+1
received SYNACK(x)
indicates server is live;
send ACK for SYNACK;
this segment may contain
client-to-server data
received ACK(y)
indicates client is live
SYNSENT
ESTAB
SYN RCVD
Client state
LISTEN
Server state
LISTEN
clientSocket = socket(AF_INET, SOCK_STREAM)
serverSocket = socket(AF_INET,SOCK_STREAM)
serverSocket.bind((‘’,serverPort))
serverSocket.listen(1)
connectionSocket, addr = serverSocket.accept()
clientSocket.connect((serverName,serverPort))
Transport Layer: 3-36

computer networks tcp road map from kurose

  • 1.
    Chapter 3: roadmap Transport-layer services  Multiplexing and demultiplexing  Connectionless transport: UDP  Principles of reliable data transfer  Connection-oriented transport: TCP • segment structure • reliable data transfer • flow control • connection management  Principles of congestion control  TCP congestion control Transport Layer: 3-1
  • 2.
    TCP: overview RFCs:793,1122, 2018, 5681, 7323  cumulative ACKs  pipelining: • TCP congestion and flow control set window size  connection-oriented: • handshaking (exchange of control messages) initializes sender, receiver state before data exchange  flow controlled: • sender will not overwhelm receiver  point-to-point: • one sender, one receiver  reliable, in-order byte stream: • no “message boundaries"  full duplex data: • bi-directional data flow in same connection • MSS: maximum segment size Transport Layer: 3-2
  • 3.
    TCP segment structure sourceport # dest port # 32 bits not used receive window flow control: # bytes receiver willing to accept sequence number segment seq #: counting bytes of data into bytestream (not segments!) application data (variable length) data sent by application into TCP socket A acknowledgement number ACK: seq # of next expected byte; A bit: this is an ACK options (variable length) TCP options head len length (of TCP header) checksum Internet checksum RST, SYN, FIN: connection management F S R Urg data pointer P U C E C, E: congestion notification Transport Layer: 3-3 RST: reset the connection Syn: Synchronize the sequence number FIN: Finish the connection
  • 4.
    4 The 4-bit headerlength field: •This specifies the length of the TCP header in 32-bit words •The TCP header can be of variable length due to the TCP options field •Typically, the options field is empty, so that the length of the typical TCP header is 20 bytes - The flag field: contains 6 bits •The ACK bit is used to indicate that the value carried in the acknowledgment field is valid, that is, the segment contains an acknowledgment for a segment that has been successfully received •The RST, SYN, and FIN bits are used for connection setup and teardown •Other flags are typically not used
  • 5.
    5 Sequence Numbers andACK Numbers - As discussed earlier for RDT protocols, the sequence number and ACK number are required for ensuring reliability - But, TCP interprets the sequence and ACK numbers differently from our early study of RDT protocols - In RDT protocols discussed earlier, the sequence and ACK numbers are interpreted to be the index of the data packet and the index of the data packet being acknowledged, respectively - But, TCP views the application data as an unstructured but ordered stream of bytes rather than as a sequence of data packets - TCP’s use of sequence numbers reflects this view •That is the TCP sequence numbers are over the stream of transmitted bytes and not over the series of transmitted segments
  • 6.
    6 Thus the sequencenumber for a segment is therefore the byte-stream number of the first byte in the segment; for example •Suppose that the data stream consists of a file consisting of 500,000 bytes, that the MSS is 1,000 bytes, and that the first byte of the data stream is numbered 0 •Then, TCP constructs 500 segments out of the data stream •The first segment gets assigned sequence number 0, the second segment gets assigned sequence number 1,000, the third segment gets assigned sequence number 2,000, and so on •Each sequence number is inserted in the sequence number field in the header of the appropriate TCP segment
  • 7.
    7 TCP is full-duplex,so that Host A may be receiving data from Host B while it sends data to Host B (as part of the same TCP connection). Host B to Host A Each of the segments that arrive from Host B has a sequence number for the data flowing from B to A. The acknowledgment number that Host A puts in its segment is the sequence number of the next byte Host A is expecting from Host B. Suppose that Host A has received all bytes numbered 0 through 535 from B and suppose that it is about to send a segment to Host B. Host A is waiting for byte 536 and all the subsequent bytes in Host B’s data stream. So Host A puts 536 in the acknowledgment number field of the segment it sends to B. .
  • 8.
  • 9.
    9 Host B toHost A suppose that Host A has received one segment from Host B containing bytes 0 through 535 and another segment containing bytes 900 through 1,000. For some reason Host A has not yet received bytes 536 through 899. In this example, Host A is still waiting for byte 536 (and beyond) in order to re-create B’s data stream. Thus, A’s next segment to B will contain 536 in the acknowledgment number field. Because TCP only acknowledges bytes up to the first missing byte in the stream, TCP is said to provide cumulative acknowledgments.
  • 10.
    10 Urgent Data For example,if the segment sequence number is 15000 and the value of the urgent pointer is 200, the first byte of urgent data is the byte 15000 and the last byte is the byte 15200. The rest of the bytes in the segment (if present) are non-urgent.
  • 11.
    TCP sequence numbers,ACKs host ACKs receipt of echoed ‘C’ host ACKs receipt of‘C’, echoes back ‘C’ simple telnet scenario Host B Host A User types‘C’ Seq=42, ACK=79, data = ‘C’ Seq=79, ACK=43, data = ‘C’ Seq=43, ACK=80 Transport Layer: 3-11 Telnet (short for "telecommunications network") is a client/server application protocol that provides access to virtual terminals of remote systems on local area networks or the Internet.
  • 12.
    12 suppose the startingsequence numbers are 42 and 79 for the client and server, respectively. Recall that the sequence number of a segment is the sequence number of the first byte in the data field. Thus, the first segment sent from the client will have sequence number 42; the first segment sent from the server will have sequence number 79. Recall that the acknowledgment number is the sequence number of the next byte of data that the host is waiting for. After the TCP connection is established but before any data is sent, the client is waiting for byte 79 and the server is waiting for byte 42.
  • 13.
    TCP round triptime, 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 Transport Layer: 3-13 the SampleRTT values will fluctuate from segment to segment due to congestion in the routers and to the varying load on the end systems
  • 14.
    TCP round triptime, timeout EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT  exponential weighted moving average (EWMA)  influence of past sample decreases exponentially fast  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) RTT (milliseconds) SampleRTT Estimated RTT RTT (milliseconds) RTT: gaia.cs.umass.edu to fantasia.eurecom.fr sampleRTT EstimatedRTT time (seconds) Transport Layer: 3-14
  • 15.
    TCP sequence numbers,ACKs Sequence numbers: • byte stream “number” of first byte in segment’s data source port # dest port # sequence number acknowledgement number checksum rwnd urg pointer outgoing segment from receiver A sent ACKed sent, not- yet ACKed (“in-flight”) usable but not yet sent not usable window size N sender sequence number space source port # dest port # sequence number acknowledgement number checksum rwnd urg pointer outgoing segment from sender Acknowledgements: • seq # of next byte expected from other side • cumulative ACK Transport Layer: 3-15
  • 16.
    TCP round triptime, timeout  timeout interval: EstimatedRTT plus “safety margin” • large variation in EstimatedRTT: want a larger safety margin TimeoutInterval = EstimatedRTT + 4*DevRTT estimated RTT “safety margin” DevRTT = (1-)*DevRTT + *|SampleRTT-EstimatedRTT| (typically,  = 0.25)  DevRTT: EWMA of SampleRTT deviation from EstimatedRTT: Transport Layer: 3-16
  • 17.
  • 18.
    18 TCP maintains asingle timer and sets the timeout value as TimeoutInterval = EstimatedRTT + 4 *DevRTT Think of the timer as being associated with the oldest unacknowledged segment An initial TimeoutInterval value of 1 second is recommended when the connection is established; as soon as a segment is received and EstimatedRTT is updated, the TimeoutInterval is computed using the formula above When a timeout occurs, the value of TimeoutInterval is doubled to avoid a premature timeout occurring for a subsequent segment; as soon as a segment is received and EstimatedRTT is updated, the TimeoutInterval is computed using the formula above Similarly, if application layer data is received but no timer is already running (this could happen, for example, when the application did not generate data for a sufficiently long time) then the TimeoutInterval is computed using the formula above
  • 19.
    19 A Simplified TCPSender (uses only timeouts to recover from lost segments) - There are three major events related to data transmission and retransmission in the simplified TCP sender: •Data received from application above •Timer timeout •ACK receipt
  • 20.
    20 - Data receivedfrom above • TCP receives data from the application, encapsulates the data in a segment, and passes the segment to IP • Each segment includes a sequence number that is the byte- stream number of the first data byte in the segment • If the timer is already not running for some other segment, TCP starts the timer when the segment is passed to IP and sets the TimeoutInterval to a value that is calculated from EstimatedRTT and DevRTT - Timeout TCP retransmits only the oldest unacknowledged segment and then restarts the timer
  • 21.
    21 Arrival of anACK (i.e., a segment containing the ACK bit set) • TCP compares the ACK value y with its variable SendBase • The TCP state variable SendBase is the sequence number of the oldest unacknowledged byte • Thus SendBase - 1 is the sequence number of the last byte that is known to have been received correctly and in order at the receiver • Since TCP uses cumulative acknowledgments, y acknowledges the receipt of all bytes before byte number y • If y > SendBase, then the ACK is acknowledging one or more previously unacknowledged segments; then the sender updates its SendBase variable; it also restarts the timer if there are any not-yet-acknowledged segments
  • 22.
  • 23.
  • 24.
  • 25.
    TCP fast retransmit HostB Host A timeout ACK=100 ACK=100 ACK=100 ACK=100 X Seq=92, 8 bytes of data Seq=100, 20 bytes of data Seq=100, 20 bytes of data Receipt of three duplicate ACKs indicates 3 segments received after a missing segment – lost segment is likely. So retransmit! if sender receives 3 additional ACKs for same data (“triple duplicate ACKs”), resend unACKed segment with smallest seq #  likely that unACKed segment lost, so don’t wait for timeout TCP fast retransmit Transport Layer: 3-25
  • 26.
    26 Mid Term examportion till this slide
  • 27.
    27 Is TCP likeGo-Back-N or Selective-Repeat? • TCP’s error-recovery mechanism is probably best categorized as a hybrid of GBN and SR protocols • - Features like Go-Back-N • TCP acknowledgments are cumulative and correctly received but out-of-order segments are not individually ACKed by the receiver • TCP sender need only maintain the smallest sequence number of a transmitted but unacknowledged byte (SendBase) and the sequence number of the next byte to be sent (NextSeqNum)
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
    33 Features like Selective-Repeat •Many TCP implementations buffer correctly received but out-of-order segments • TCP retransmits only one segment when a timeout occurs or triple-duplicate ACKs are recived, unlike Go-Back-N that retransmits all outstanding segments • A proposed modification to TCP, the so-called selective acknowledgment [RFC 2018], allows a TCP receiver to acknowledge out-of-order segments selectively rather than just cumulatively acknowledging the last correctly received, in-order segment
  • 34.
  • 35.
  • 36.
    TCP 3-way handshake SYNbit=1,Seq=x choose init seq num, x send TCP SYN msg ESTAB SYNbit=1, Seq=y ACKbit=1; ACKnum=x+1 choose init seq num, y send TCP SYNACK msg, acking SYN ACKbit=1, ACKnum=y+1 received SYNACK(x) indicates server is live; send ACK for SYNACK; this segment may contain client-to-server data received ACK(y) indicates client is live SYNSENT ESTAB SYN RCVD Client state LISTEN Server state LISTEN clientSocket = socket(AF_INET, SOCK_STREAM) serverSocket = socket(AF_INET,SOCK_STREAM) serverSocket.bind((‘’,serverPort)) serverSocket.listen(1) connectionSocket, addr = serverSocket.accept() clientSocket.connect((serverName,serverPort)) Transport Layer: 3-36

Editor's Notes

  • #2 TCP (Transmission Control Protocol) is a stream-oriented protocol, meaning it treats data as a continuous flow rather than discrete messages. This means there are no inherent message boundaries in TCP.
  • #11 Telnet, defined in RFC 854, is a popular application-layer protocol used for remote login. It runs over TCP and is designed to work between any pair of hosts. The key thing to note here is that the ACK number (43) on the B-to-A segment is one more than the sequence number (42) on the A-to-B segment that triggered that ACK Similarly, the ACK number (80) on the last A-to-B segment is one more than the sequence number (79) on the B-to-A segment that triggered that ACK
  • #14  This is how TCP re-computes the estimated RTT each time a new SampleRTT is taken. The process is knows as an exponentially weighted moving average, shown by the equation here. <say it> Where alpha reflects the influence of the most recent measurements on the estimated RTT; a typical value of alpha used in implementations is .125 The graph at the bottom show measured RTTs between a host in the Massachusetts and a host in France, as well as the estimated, “smoothed” RTT
  • #16 Given this value of the estimated RTT, TCP computes the timeout interval to be the estimated RTT plus a “safety margin” And the intuition is that if we are seeing a large variation in SAMPLERTT – the RTT estimates are fluctuating a lot - then we’ll want a larger safety margin So TCP computes the Timeout interval to be the Estimated RTT plus 4 times a measure of deviation in the RTT. The deviation in the RTT is computed as the eWMA of the difference between the most recently measured SampleRTT from the Estimated RTT
  • #25 Let’s wrap up our study of TCP reliability by discussing an optimization to the original TCP known as TCP fast retransmit, Take a look at this example on the right where 5 segments are transmitted and the second segment is lost. In this case the TCP receiver sends an ACK 100 acknowledging the first received segment. When the third segment arrives at the receiver, the TCP receiver sends another ACK 100 since the second segment has not arrived. And similarly for the 4th and 5th segments to arrive. Now what does the sender see? The sender receives the first ACK 100 it has been hoping for, but then three additional duplicate ACK100s arrive. The sender knows that somethings’ wrong – it knows the first segment arrived at the receiver but three later arriving segments at the receiver – the ones that generated the three duplicate ACKs – we received correctly but were not in order. That is, that there was a missing segment at the receiver when each of the three duplicate ACK were generated. With fast retransmit, the arrival of three duplicate ACK causes the sender to retransmit its oldest unACKed segment, without waiting for a timeout event. This allows TCP to recover more quickly from what is very likely a loss event specifically that the second segment has been lost, since three higher -numbered segments were received
  • #36 TCP’s three way handshake, that operates as follows Let’s say the client and server both create a TCP socket as we learned about in Chapter 2 and enter the LISTEN state The client then connects to the server sending a SYN message with a sequence number x (SYN Message is an TCP Segment with SYN but set in the header – you might want to go back and review the TCP segment format!) The server is waiting for a connection, and receives the SYN message enters the SYN received state (NOT the established state and sends a SYN ACK message back. Finally the client sends an ACK message to the server, and when the server receiver this enters the Established state. This is when the application process would see the return from the wait on the socket accept() call