Beruflich Dokumente
Kultur Dokumente
Transport Layer
Goals: understand principles behind transport layer services: -multiplexing/demultiplexing -reliable data transfer -flow control -congestion control learn about transport layer protocols in the Internet: UDP: connectionless transport TCP: connection-oriented transport TCP congestion control
nd -e nd le ca gi lo
rt po ns tra
network data link physical application transport network data link physical
network data link physical application transport network data link physical
Multiplexing/demultiplexing
Demultiplexing at rcv host: delivering received segments to correct socket
= socket application transport network link physical P3 = process P1 P1 application transport network link physical P2 P4 application transport network link physical
Multiplexing at send host: gathering data from multiple sockets, enveloping data with header (later used for demultiplexing)
host 1
host 2
host 3
Connectionless demultiplexing
Create sockets with port numbers:
DatagramSocket mySocket1 = new DatagramSocket(12534); DatagramSocket mySocket2 = new DatagramSocket(12535);
client IP: A
server IP: C
Client
IP:B
Connection-oriented demux
TCP socket identified by 4-tuple:
source IP address source port number dest IP address dest port number
recv host uses all four values to direct segment to appropriate socket
UDP: more
-often used for streaming multimedia apps loss tolerant Length, in rate sensitive bytes of UDP
32 bits source port # length dest port # checksum
DNS SNMP -reliable transfer over UDP: add reliability at application layer -application-specific error recovery!
UDP checksum
Goal: detect errors (e.g., flipped bits) in transmitted segment Sender:
treat segment contents as sequence of 16-bit integers checksum: addition (1s complement sum) of segment contents sender puts checksum value into UDP checksum field compute checksum of received segment check if computed checksum equals checksum field value: NO - error detected YES - no error detected. But maybe errors nonetheless? More later .
Receiver:
TCP: Overview
point-to-point:
one sender, one receiver
connection-oriented:
pipelined:
handshaking (exchange of control msgs) inits sender, receiver state before data exchange
flow controlled:
socket door
socket door
a p p lic a t io n re a d s d a ta TC P r e c e iv e b u f f e r
source port #
dest port #
checksum
Host B
= C
Seq=
Seq=4 3,
ACK=
80
too short: premature timeout unnecessary retransmissions too long: slow reaction to segment loss
300
250
200
150
first estimate of how much SampleRTT deviates from EstimatedRTT: DevRTT = (1-)*DevRTT + *|SampleRTT-EstimatedRTT| (typically, = 0.25) Then set timeout interval: TimeoutInterval = EstimatedRTT + 4*DevRTT
update what is known to be acked start timer if there are outstanding segments
timeout: retransmit segment that caused timeout restart timer Ack rcvd: If acknowledges previously unacked segments
Host B
8 byte s data
Host A
Host B
loss
Seq=9 2, 8 b y tes da ta
100 C K= A
Seq=92 timeout
timeout
AC
00 K= 1
Seq=9 2, 8 b y
tes da ta
Seq=92 timeout
=1 CK A
20
premature timeout
Host B
bytes data
loss
=120 ACK
Fast Retransmit
Time-out period often relatively long:
-long delay before resending lost packet
If sender receives 3 ACKs for the same data, it supposes that segment after ACKed data was lost:
fast retransmit: resend segment before timer expires
-Sender often sends many segments back-to-back -If segment is lost, there will likely be many duplicate ACKs.
sender wont overflow receivers buffer by transmitting too much, too fast
flow control
speed-matching service: matching the send rate to the receiving apps drain rate
app process may be
Rcvr advertises spare room by including value of RcvWindow in segments Sender limits unACKed data to RcvWindow
guarantees receive buffer doesnt overflow
server
close
timed wait
ACK
closed
server
ACK FIN
closing
ACK
closed
closed
Host A
in : original data
out
Host B
out
Host B
Host A