Transcript Document
ICE 302
TRANSPORT LAYER
Md. Asif Hossain
1
Term # 2
Lecture # 2
Thanks to
A. B. Forouzan
This is the presentation slides of the Book
3rd Edition
You MUST go through this TEXT BOOK for your
further learning and for the EXAMS.
So, without reading the Book, you can not pass the
exams.
Read the topics that will be covered in the classes.
You can take the helps from the other related Books.
2
TRANSMISSION CONTROL PROTOCOL
Port numbers
17/07/2015
Port
Protocol
Description
Echoes a received datagram back to the
sender
7
Echo
9
Discard
11
Users
13
Daytime
17
Quote
19
Charger
20
FTP, Data
21
FTP, Control
23
TELNET
25
SMTP
53
DNS
67
BOOTP
79
Finger
Finger
80
HTTP
Hypertext Transfer Protocol
111
RPC
Remote Procedure Call
Discards any datagram that is received
Active users
Returns the date and the time
Returns a quote of the day
Returns a string of characters
File Transfer Protocol (data connection)
File Transfer Protocol (control connection)
Terminal Network
Simple Mail Transfer Protocol
Domain Name Server
Bootstrap Protocol
3
TRANSMISSION CONTROL PROTOCOL
Byte-stream connection-oriented & reliable transport protocol
17/07/2015
4
TCP - BUFFERS
Sending & receiving buffers
Sending site:
Processes do not consume data at the same speed
White section: empty locations to be filled by sending process
Blue section: bytes sent but not yet acknowledged
Red section: bytes to be sent by sending TCP
Receiving site:
White section: empty locations to be filled by bytes from the networks
Red section: received bytes to be consumed by the receiving process
17/07/2015
5
TCP – BYTES & SEGMENTS
TCP at the sending site gathers bytes into a packet called
a segment
TCP adds a header to each segment and delivers it to IP for
transmission
Segments can arrive out of order
Size of the segment varies
17/07/2015
6
TCP – NUMBERING BYTES
Sequence number
The number of the first byte carried in the segment
Acknowledgement number
To confirm received bytes
Defines the number of the next byte the party expects to
receive
7
Cumulative
17/07/2015
Numbering is used for flow & error control
Segments are not numbered, only bytes
Full-duplex connection – numbering is independent
in each direction
Numbers generated randomly from 0 to 232-1
TCP NUMBERING – AN EXAMPLE
Imagine a TCP connection is transferring a file of 6000 bytes.
The first byte is numbered 10010.
What are the sequence numbers for each segment if data are
sent in five segments with the first four segments carrying
1000 bytes and the last segment carrying 2000 bytes?
The following shows the sequence number for each segment:
Segment
Segment
Segment
Segment
Segment
1
2
3
4
5
==>
==>
==>
==>
==>
17/07/2015
sequence
sequence
sequence
sequence
sequence
number:
number:
number:
number:
number:
10
11
12
13
14
010
010
010
010
010
(range:
(range:
(range:
(range:
(range:
10,010
11,010
12,010
13,010
14,010
to 11,009)
to 12,009)
to 13,009)
to 14,009)
to 16,009)
8
TCP SEGMENT FORMAT
17/07/2015
9
TCP - CONNECTIONS
Connection establishment
Three-way handshake
Why is two-way handshake
not enough?
• Connection termination
– Four steps
17/07/2015
10
TCP – A STATE TRANSITION DIAGRAM
3-11
TCP server
lifecycle
TCP client
lifecycle
Tran
sport
Laye
r
FLOW CONTROL
Remember?
The amount of data a source can send before receiving
an ACK from the destination
Whether to send 1 byte of data and wait for ACK or
send all bytes and wait for the ACK for the complete
message?
TCP gives a solution in between
Sliding window protocol
byte oriented
12
FLOW CONTROL
Avoids
the problem of a host at one side of the
connection overflowing the buffers in the host
at the other side
Ensures the integrity of the data
SESSION MAINTENANCE AND TERMINATION
Congestion
can occur
during data transfer
To terminate, the
sending host sends a
signal that indicates the
end of the transmission,
which is acknowledged
by the receiver.
FLOW CONTROL (CNT’D)
sender buffer
Direction of transmission
If no window, a sender can send all bytes without regarding
the condition of the receiver
if data are consumed too slowly then receiver buffer becomes full
-> drop the packet (retransmit)
the sender must adjust itself to the number of the free locations
in the receiver buffer
17/07/2015
15
FLOW CONTROL (CNT’D)
Receiver window
17/07/2015
M
N
N-M = receiver window
• Sender window
16
FLOW CONTROL (CNT’D)
Direction of window shift
sliding widow
ACK is
received for
bytes 200-202
the sender can
send bytes 205209
Direction of transmission
• expanding the
sender widow
• shrinking the
sender widow
17/07/2015
17
PERFORMANCE OF RDT 3.0
(RELIABLE DATA TRANSFER OVER A LOSSY CHANNEL WITH BIT ERRORS)
rdt3.0 works, but performance stinks
example: 1 Gbps link, 15 ms e-e prop. delay, 1KB
packet:
Ttransmit =
U
L (packet length in bits)
R (transmission rate, bps)
sender
=
L/R
RTT + L / R
=
=
.008
30.008
8kb/pkt
10^9 b/sec
= 8 microsec
= 0.00027
microsec
onds
U sender: utilization – fraction of time sender busy sending
1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link
network protocol limits use of physical resources!
3-18
PIPELINED PROTOCOLS
Pipelining: sender allows multiple, “in-flight”, yetto-be-acknowledged pkts
range of sequence numbers must be increased
buffering at sender and/or receiver
Transport Layer
Two generic forms of pipelined protocols: go-Back-N,
3-20
selective repeat
THE “A” FACTOR
a = (Round Trip Time)/(Transmission time)
3-22
Transmission time (L) is usually represented in bits
and Round Trip Time (RTT) is usually given in time
units (say 50 ms).
small a – implies low RTT or Large L; usually LANs
with large packets.
large a – implies high RTT or small L; usually WANs
or LANS with small packets; or highly congested
network.
Tran
sport
Laye
r
STOP AND WAIT LINK UTILIZATION (CONT.)
Tx
3-23
time = RTT + L +TA
TA – time to tx ack frame (small and
ignored)
Therefore, Tx time = RTT + L
U
= L/(Tx time)= L/(L+RTT)= 1/(1+a)
For large a, U is small
For small a, U is high
Tran
sport
Laye
r
GO-BACK-N
In
a GBN protocol, the sender is allowed to
transmit multiple packets without waiting for
an acknowledgment, but is constrained to have
no more than some maximum allowable
number, N, of unacknowledged packets in the
pipeline.
GBN IN
ACTION
3-25
Tran
sport
Laye
r
SELECTIVE REPEAT
receiver individually acknowledges all correctly
received pkts
sender only resends pkts for which ACK not
received
buffers pkts, as needed, for eventual in-order delivery to
upper layer
Transport Layer
sender timer for each unACKed pkt
sender window
N consecutive seq #’s
again limits seq #s of sent, unACKed pkts
3-26
SELECTIVE REPEAT IN ACTION
3-27
Tran
sport
Laye
r
ERROR CONTROL IN TCP
Detect corrupted segments; lost segments; outof-order segments & duplicated segments
Three tools:
17/07/2015
checksum
2. acknowledgment
1.
–
3.
no NACKs
time-out
–
one time-out counter for each segment sent
28
ERROR CONTROL IN TCP
-LOST OR CORRUPTED SEGMENT 17/07/2015
29
ERROR CONTROL IN TCP
-DUPLICATE & OUT-OF-ORDER SEGMENTDuplicate segment
the destination TCP simply discards the segment
17/07/2015
Out-of-order segment
not acknowledged until it receives all the segments
that precede it
30
TCP TIMERS
17/07/2015
1. Retransmission
Persistence
Keep-alive
Time-waited
31