7/27/2019 Lecture 23 & 24
1/41
1
Computer Communication &Networks
Lecture 23 & 24
Transport Layer: UDP and TCP
http://web.uettaxila.edu.pk/CMS/coeCCNbsSp09/index.asp
Waleed Ejaz
http://web.uettaxila.edu.pk/CMS/coeCCNbsSp09/index.aspmailto:[email protected]:[email protected]://web.uettaxila.edu.pk/CMS/coeCCNbsSp09/index.asp7/27/2019 Lecture 23 & 24
2/41
2
Transport Layer
7/27/2019 Lecture 23 & 24
3/41
3
Transport Layer Topics to Cover
UDP, TCP
7/27/2019 Lecture 23 & 24
4/41
4
Process-to-Process Delivery
The transport layer is responsible for
process-to-process deliverythe delivery of
a packet, part of a message, from one
process to another. Two processescommunicate in a client/server relationship,
as we will see later.
7/27/2019 Lecture 23 & 24
5/41
5
Types of Data Deliveries
7/27/2019 Lecture 23 & 24
6/41
6
Port Numbers
7/27/2019 Lecture 23 & 24
7/41
7
IP addresses versus port numbers
7/27/2019 Lecture 23 & 24
8/41
8
Internet Assigned Number Authority (IANA) Ranges
7/27/2019 Lecture 23 & 24
9/41
9
Socket address
7/27/2019 Lecture 23 & 24
10/41
10
Multiplexing and demultiplexing
7/27/2019 Lecture 23 & 24
11/41
11
Error control
7/27/2019 Lecture 23 & 24
12/41
12
Position of UDP, TCP, and SCTP in TCP/IP suite
7/27/2019 Lecture 23 & 24
13/41
13
User Datagram Protocol (UDP)
7/27/2019 Lecture 23 & 24
14/41
14
User Datagram Protocol (UDP)
The User Datagram Protocol (UDP) is called
a connectionless, unreliable transport
protocol. It does not add anything to the
services of IP except to provide process-to-process communication instead of host-to-
host communication.
7/27/2019 Lecture 23 & 24
15/41
15
Well-known ports used with UDP
7/27/2019 Lecture 23 & 24
16/41
16
User Datagram Format
7/27/2019 Lecture 23 & 24
17/41
17
UDP Operation
Connectionless Services
Flow and Error Control
No flow control
No Error Control except Checksum
Encapsulation & Decapsulation
7/27/2019 Lecture 23 & 24
18/41
18
Queues in UDP
7/27/2019 Lecture 23 & 24
19/41
19
TCP
7/27/2019 Lecture 23 & 24
20/41
20
TCP
TCP is a connection-oriented protocol; it
creates a virtual connection between two
TCPs to send data. In addition, TCP uses
flow and error control mechanisms at thetransport level.
7/27/2019 Lecture 23 & 24
21/41
21
Well-known ports used by TCP
7/27/2019 Lecture 23 & 24
22/41
22
Stream delivery
7/27/2019 Lecture 23 & 24
23/41
23
Sending and receiving buffers
7/27/2019 Lecture 23 & 24
24/41
24
TCP segments
7/27/2019 Lecture 23 & 24
25/41
25
Example The bytes of data being transferred in each connection are
numbered by TCP. The numbering starts with a randomlygenerated number.
The value in the sequence number field of a segment defines
the number of the first data byte contained in that segment. The value of the acknowledgment field in a segment defines
the number of the next byte a party expects to receive. Theacknowledgment number is cumulative.
7/27/2019 Lecture 23 & 24
26/41
26
TCP segment format20 to 60 Byte header
7/27/2019 Lecture 23 & 24
27/41
27
Connection establishment using three-way
handshaking A SYN segment
cannot carry data,but it consumes onesequence number.
A SYN + ACK
segment cannotcarry data, but doesconsume onesequence number.
An ACK segment, if
carrying no data,consumes nosequence number.
7/27/2019 Lecture 23 & 24
28/41
28
Data transfer
7/27/2019 Lecture 23 & 24
29/41
29
Connection termination using three-way
handshaking
The FIN segmentconsumes onesequencenumber if it does
not carry data. The FIN + ACK
segmentconsumes
one sequencenumber if itdoes not carrydata.
7/27/2019 Lecture 23 & 24
30/41
30
Half Close
7/27/2019 Lecture 23 & 24
31/41
31
Sliding Window Protocol A sliding window is used to make
transmission more efficient as well as tocontrol the flow of data so that the destination
does not become overwhelmed with data.
TCP sliding windows are byte-oriented.
7/27/2019 Lecture 23 & 24
32/41
32
F igure on next sl ide shows an unrealistic example of a
sl iding window. The sender has sent bytes up to 202. We
assume that cwnd is 20 (in reali ty this value is thousands
of bytes). The receiver has sent an acknowledgment
number of 200 with an rwnd of 9 bytes (in reali ty thisvalue is thousands of bytes). The size of the sender
window is the minimum of rwnd and cwnd, or 9 bytes.
Bytes 200 to 202 are sent, but not acknowledged. Bytes
203 to 208 can be sent without worrying aboutacknowledgment. Bytes 209 and above cannot be sent.
Example
7/27/2019 Lecture 23 & 24
33/41
33
Example
7/27/2019 Lecture 23 & 24
34/41
34
ACK segments do not consumesequence numbers and are not
acknowledged.
Note
7/27/2019 Lecture 23 & 24
35/41
35
In modern implementations, aretransmission occurs if the
retransmission timer expires or three
duplicate ACK segments have arrived.
Note
7/27/2019 Lecture 23 & 24
36/41
36
No retransmission timer is set for anACK segment.
Note
7/27/2019 Lecture 23 & 24
37/41
37
Data may arrive out of order and betemporarily stored by the receiving TCP,
but TCP guarantees that no out-of-order
segment is delivered to the process.
Note
7/27/2019 Lecture 23 & 24
38/41
38
Normal operation
7/27/2019 Lecture 23 & 24
39/41
39
Lost Segment
7/27/2019 Lecture 23 & 24
40/41
40
The receiver TCP delivers only ordered
data to the process.
Note
7/27/2019 Lecture 23 & 24
41/41
Fast Retransmission
Top Related