Chapter - 2 Lec 3&4
Chapter - 2 Lec 3&4
Chapter - 2 Lec 3&4
Layer
Ø Lecture 3:
2.1 Internet transport protocol
ü UDP
ü TCP Computer Networking: A
ü SCTP Top-Down Approach
2.2 Congestion control 8th edition
Jim Kurose, Keith Ross
Pearson, 2020
Chapter 2: Network and Transport layer
Our goal:
l og
ica
l en
§ transport protocols actions in end
d-e
systems:
nd
local or
tra
• sender: breaks application messages regional ISP
nsp
into segments, passes to network layer
or t
home network content
• receiver: reassembles segments into provider
network
messages, passes to application layer datacenter
application
transport
network
network
Sender:
application § is passed an application- app. msg
application
layer message
transport
§ determines segment TTh htransport
app. msg
header fields values
network (IP)
§ creates segment network (IP)
link
§ passes segment to IP link
physical physical
Receiver:
application § receives segment from IP application
§ checks header values
app. msg
transport § extracts application-layer transport
message
network (IP)
network (IP) § demultiplexes message up
link to application via socket link
physical physical
Th app. msg
• congestion control
l og
ica
• flow control
l en
d-e
• connection setup
nd
local or
§ UDP: User Datagram Protocol
tra
regional ISP
nsp
• unreliable, unordered delivery
or t
home network content
• no-frills extension of “best-effort” IP provider
network datacenter
application
network
transport
Hn Ht HTTP msg
client
application application
HTTP msg
HTTP msg Ht HTTP msg
transport
application application
transport transport
(UDP) (UDP)
link link
physical physical
network (IP)
§ creates UDP segment network (IP)
link
§ passes segment to IP link
physical physical
h SNMP(IP)
network
UDP msg message network (IP)
§ demultiplexes message up
link to application via socket link
physical physical
data to/from
UDP segment format application layer
Transmitted: 5 6 11
Received: 4 6 11
receiver-computed
checksum
= sender-computed
checksum (as received)
sum 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
Note: when adding numbers, a carryout from the most significant bit needs to be
added to the result
* Check out the online interactive exercises for more examples: http://gaia.cs.umass.edu/kurose_ross/interactive/
Transport Layer: 3-30
Internet checksum: weak protection!
example: add two 16-bit integers
0 1
1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0
1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 Even though
numbers have
sum 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 changed (bit flips),
no change in
checksum 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 checksum!
• flow control
• connection management
window size
Acknowledgements: N
User types‘C’
Seq=42, ACK=79, data = ‘C’
host ACKs receipt
of‘C’, echoes back ‘C’
Seq=79, ACK=43, data = ‘C’
host ACKs receipt
of echoed ‘C’
Seq=43, ACK=80
RTT (milliseconds)
sampleRTT
EstimatedRTT
* Check out the online interactive exercises for more examples: http://gaia.cs.umass.edu/kurose_ross/interactive/
Transport Layer: 3-44
TCP Sender (simplified)
event: data received from event: timeout
application § retransmit segment that
caused timeout
§ create segment with seq #
§ restart timer
§ seq # is byte-stream number
of first data byte in segment
event: ACK received
§ start timer if not already
running § if ACK acknowledges
previously unACKed segments
• think of timer as for oldest
unACKed segment • update what is known to be
ACKed
• expiration interval:
TimeOutInterval • start timer if there are still
unACKed segments
Transport Layer: 3-45
TCP Receiver: ACK generation [RFC 5681]
Event at receiver TCP receiver action
arrival of in-order segment with delayed ACK. Wait up to 500ms
expected seq #. All data up to for next segment. If no next segment,
expected seq # already ACKed send ACK
SendBase=92
Seq=92, 8 bytes of data Seq=92, 8 bytes of data
timeout
ACK=100
X
ACK=100
ACK=120
SendBase=120
=100
timeout
A CK
=100
ACK
K=100
Receipt of three duplicate ACKs AC
TCP
code
Network layer
delivering IP datagram
payload into TCP
IP
socket buffers
code
from sender
TCP
code
Network layer
delivering IP datagram
payload into TCP
IP
socket buffers
code
from sender
TCP
code
receive window
flow control: # bytes
receiver willing to accept IP
code
from sender
TCP
flow control code
application application
network network
choose x
req_conn(x)
ESTAB
acc_conn(x)
ESTAB
data(x+1) accept
ACK(x+1) data(x+1)
connection
x completes
No problem!
choose x
req_conn(x)
ESTAB
retransmit acc_conn(x)
req_conn(x)
ESTAB
req_conn(x)
connection
client x completes server
terminates forgets x
ESTAB
acc_conn(x)
Problem: half open
connection! (no client)
Transport Layer: 3-59
2-way handshake scenarios
choose x
req_conn(x)
ESTAB
retransmit acc_conn(x)
req_conn(x)
ESTAB
data(x+1) accept
data(x+1)
retransmit
data(x+1)
connection
x completes server
client
terminates forgets x
req_conn(x)
ESTAB
data(x+1) accept
data(x+1)
Problem: dup data
accepted!
TCP 3-way handshake
Server state
serverSocket = socket(AF_INET,SOCK_STREAM)
Client state serverSocket.bind((‘’,serverPort))
serverSocket.listen(1)
clientSocket = socket(AF_INET, SOCK_STREAM) connectionSocket, addr = serverSocket.accept()
LISTEN
clientSocket.connect((serverName,serverPort)) LISTEN
choose init seq num, x
send TCP SYN msg
SYNSENT SYNbit=1, Seq=x
choose init seq num, y
send TCP SYNACK
msg, acking SYN SYN RCVD
SYNbit=1, Seq=y
ACKbit=1; ACKnum=x+1
received SYNACK(x)
ESTAB indicates server is live;
send ACK for SYNACK;
this segment may contain ACKbit=1, ACKnum=y+1
client-to-server data
received ACK(y)
indicates client is live
ESTAB
81
Source based approach
§ Hop-by-Hop choke
packets
• Have choke packet
take effect at every
hop
• Problem: more
buffers needed in
routers
82
Load shedding
§ Throw away packets that cannot be handled!!
§ Packet selection?
§ Random early detection
• Discard packets before all buffer space is exhausted
• Routers maintain running average of queue lengths
• Select at random a packet
• Inform source?
• Send choke packet? è more load!!
• No reporting
• When does it work?
• Source slows down when packets are lost
Congestion: jitter control
§Important for audio and video applications?
• not delay
• variance of delay
Congestion: jitter control
§ Jitter = variation in packet delay
§ Compute feasible mean value for delay
• compute expected transit time for each hop
• router checks to see if packet is
• behind
• ahead schedule
• behind: forward packet asap
• ahead: hold back packet to get it on schedule again
§ Buffering? Depends on characteristics:
• Video on demand: ok
• Videoconferencing: nok
ØLecture 4
Routing Algorithms/protocols