DataCommChapter 6 Part 2
DataCommChapter 6 Part 2
1
The Internet model has three protocols at the
transport layer: UDP, TCP & SCTP
2
Position of UDP, TCP, and SCTP in TCP/IP suite
3
6.4: USER DATAGRAM PROTOCOL (UDP)
4
UDP is a simpler protocol compared to TCP.
It has no connection, flow control, congestion control, sequencing,
packet acknowledgement and reliability.
There is no control mechanism for detecting lost packets, out-of-order
packets and duplicate packets.
It only provides error control for detecting corrupted packets using
checksum.
Processes which involved sending small message or do not care about
reliability can use UDP.
It is used by application protocols such as TFTP, SNMP, RTP and etc.
UDP is also a suitable transport protocol for multicasting of real time
multimedia.
In transport layer of TCP/IP model.
5
Well-known ports used with UDP
6
User datagram format
Source port number: the port number used by the process running on the source host.
Destination port number: the port number used by the process running on the
destination
Check sum: detects errors over the entire user datagram, (header+data)
Length: defines the total length of the user datagram, (header+data)
7
Note
UDP length
= IP length – IP header’s length
8
Pseudoheader for checksum calculation
The pseudoheader is a part of the header of the IP packet in which the user datagram
is to be encapsulated with some fields filled with 0s.
9
Example 1
The next figure shows the checksum calculation for a
very small user datagram with only 7 bytes of data.
Because the number of bytes of data is odd, padding is
added for checksum calculation. The pseudoheader as
well as the padding will be dropped when the user
datagram is delivered to IP.
10
Checksum calculation of a simple UDP user datagram
11
6.5: TCP
12
Well-known ports used by TCP
Like UDP, TCP provides process to process communication using port numbers.
13
Stream delivery
The sending process produces (write to) the stream of bytes, and the receiving
Produces consumes (reads from) them.
14
Sending and receiving buffers
TCP needs buffers for storage because the sending and receiving may not write or
read data at the same speed.
15
TCP segments
At the transport layer- TCP groups a number of bytes together into a packet:segment,
adds a header to each segment (for control purposes) and delivers the segment to the
IP layer for transmission.
16
Note
17
Example 2
Solution:
The following shows the sequence number for each segment:
18
Note
19
Note
20
TCP segment format
21
Control field
22
Description of flags in the control field
23
TCP Connection
24
Connection establishment using three-way handshaking
Phase 1:
25
Note
26
Note
27
Note
28
Data transfer
Phase 2:
29
Connection termination using three-way handshaking
Phase 3:
30
Note
31
Note
32
Half-close
Half-close: One end can stop sending data while still receiving data
33
Flow Control
The size of the window at one end is determined by the lesser of two values:
receiver window (rwnd) or congestion window (cwnd)
34
Note
35
Example 3
What is the value of the receiver window (rwnd) for host A if
the receiver, host B, has a buffer size of 5000 bytes and 1000
bytes of received and unprocessed data?
Solution
The value of rwnd = 5000 − 1000 = 4000. Host B
can receive only 4000 bytes of data before
overflowing its buffer. Host B advertises this value
in its next segment to A.
36
Example 4
What is the size of the window for host A if the value of rwnd
is 3000 bytes and the value of cwnd is 3500 bytes?
Solution
The size of the window is the smaller of rwnd and
cwnd, which is 3000 bytes.
37
Example 5
38
39
Note
41
Note
42
Note
43
Note
44
Error Control
45
Normal operation
46
Lost segment
47
Note
48
Fast retransmission
49
Congestion Control
50
Slow start, exponential increase
51
Note
52
Congestion avoidance, additive increase
53
Note
54
Note
55
TCP congestion policy summary
56
TCP vs. UDP
57