You are on page 1of 145

Transport Layer

Computer Networks

5th IT

1
What Transport layer does?
 Transport layer is responsible for the delivery of a
message from one process to another.
 Transport layer protocol can be connection
oriented or connection less.
 Transport layer divide the message into
transmittable segments
 UDP is connection less protocol- It handles each
segment separately
 TCP is connection oriented protocol- Create the
relationship between Segments using sequence
numbers
 Transport layer is responsible for Error and Flow
control
2
Position of transport layer

3
Transport layer duties

4
Types of data deliveries

5
Port numbers

Destination IP address is used to identify the


host in the world. After the host is selected ,the
port number defines one of the processes on
this host.
6
IP addresses versus port numbers

7
IANA(Internet Assigned Number Authority) ranges

8
Socket address

9
Encapsulation and decapsulation
Multiplexing and demultiplexing

11
12
13
Connection establishment

14
Connection termination

15
Error control

16
17
Connectionless service
Connection-oriented service

19
20
UDP is a connectionless, unreliable
protocol that has no flow and error
control. It uses port numbers to
multiplex data from the application
layer.

21
22
Table 22.1 Well-known ports used by UDP
Port Protocol Description
7 Echo Echoes a received datagram back to the sender
9 Discard Discards any datagram that is received
11 Users Active users
13 Daytime Returns the date and the time
17 Quote Returns a quote of the day
19 Chargen Returns a string of characters
53 Nameserver Domain Name Service
67 Bootps Server port to download bootstrap information
68 Bootpc Client port to download bootstrap information
69 TFTP Trivial File Transfer Protocol
111 RPC Remote Procedure Call
123 NTP Network Time Protocol
161 SNMP Simple Network Management Protocol
162 SNMP Simple Network Management Protocol (trap)
23
User datagram format

24
User datagram format

CheckSum: This field is used to detect the errors over the entire user
datagram.

25
Checksum calculation

26
27
Example.

28
The calculation of checksum and its
inclusion in the user datagram are
optional.

29
Note:

UDP is a convenient transport-layer


protocol for applications that provide
flow and error control. It is also used
by multimedia applications.

30
22.3 TCP

Port Numbers
Services
Sequence Numbers
Segments
Connection
Transition Diagram
Flow and Error Control
Silly Window Syndrome
31
Table 22.2 Well-known ports used by TCP
Port Protocol Description
7 Echo Echoes a received datagram back to the sender
9 Discard Discards any datagram that is received
11 Users Active users
13 Daytime Returns the date and the time
17 Quote Returns a quote of the day
19 Chargen Returns a string of characters
20 FTP, Data File Transfer Protocol (data connection)
21 FTP, Control File Transfer Protocol (control connection)
23 TELNET Terminal Network
25 SMTP Simple Mail Transfer Protocol
53 DNS Domain Name Server
67 BOOTP Bootstrap Protocol
79 Finger Finger
80 HTTP Hypertext Transfer Protocol
111 RPC Remote Procedure Call
32
Figure 22.11 Stream delivery

33
Figure 22.12 Sending and receiving buffers

34
Figure 22.13 TCP segments

35
Example 1
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?

Solution
The following shows the sequence number for each segment:
Segment 1 ==> sequence number: 10,010 (range: 10,010 to 11,009)
Segment 2 ==> sequence number: 11,010 (range: 11,010 to 12,009)
Segment 3 ==> sequence number: 12,010 (range: 12,010 to 13,009)
Segment 4 ==> sequence number: 13,010 (range: 13,010 to 14,009)
Segment 5 ==> sequence number: 14,010 (range: 14,010 to 16,009)

36
Note:

The bytes of data being transferred in


each connection are numbered by
TCP. The numbering starts with a
randomly generated number.

37
Note:

The value of the sequence number


field in a segment defines the number
of the first data byte contained in that
segment.

38
Note:

The value of the acknowledgment field


in a segment defines the number of the
next byte a party expects to receive.
The acknowledgment number is
cumulative.

39
Figure 22.14 TCP segment format

40
Figure 22.15 Control field

41
Table 22.3 Description of flags in the control field

Flag Description

URG The value of the urgent pointer field is valid.

ACK The value of the acknowledgment field is valid.

PSH Push the data.

RST The connection must be reset.

SYN Synchronize sequence numbers during connection.

FIN Terminate the connection.

42
Figure 22.16 Three-step connection establishment

43
Figure 22.17 Four-step connection termination

44
Table 22.4 States for TCP

State Description

CLOSED There is no connection.


LISTEN The server is waiting for calls from the client.
SYN-SENT A connection request is sent; waiting for acknowledgment.
SYN-RCVD A connection request is received.
ESTABLISHED Connection is established.
FIN-WAIT-1 The application has requested the closing of the connection.
FIN-WAIT-2 The other side has accepted the closing of the connection.
TIME-WAIT Waiting for retransmitted segments to die.
CLOSE-WAIT The server is waiting for the application to close.
LAST-ACK The server is waiting for the last acknowledgment.

45
Figure 22.18 State transition diagram

46
Note:

A sliding window is used to make


transmission more efficient as well as
to control the flow of data so that the
destination does not become
overwhelmed with data. TCP’s sliding
windows are byte-oriented.

47
Figure 22.19 Sender buffer

48
Figure 22.20 Receiver window

49
Figure 22.21 Sender buffer and sender window

50
Figure 22.22 Sliding the sender window

51
Figure 22.23 Expanding the sender window

52
Figure 22.24 Shrinking the sender window

53
Note:

In TCP, the sender window size is


totally controlled by the receiver
window value (the number of empty
locations in the receiver buffer).
However, the actual window size can
be smaller if there is congestion in the
network.
54
Note:

Some points about TCP’s sliding windows:


The source does not have to send a full
window’s worth of data.

The size of the window can be increased or


decreased by the destination.

The destination can send an acknowledgment


at any time.

55
Figure 22.25 Lost segment

56
Figure 22.26 Lost acknowledgment

57
Figure 22.27 TCP timers

58
Multiplexing

59
Figure 6.1 Dividing a link into channels

60
Figure 6.2 Categories of multiplexing

61
6.1 FDM

Multiplexing Process
Demultiplexing Process
The Analog Hierarchy
Other Applications of FDM
Implementation

62
Figure 6.3 FDM

63
Note:

FDM is an analog multiplexing


technique that combines signals.

64
Figure 6.4 FDM process

65
Figure 6.5 FDM demultiplexing example

66
Example 1
Assume that a voice channel occupies a bandwidth of 4
KHz. We need to combine three voice channels into a link
with a bandwidth of 12 KHz, from 20 to 32 KHz. Show
the configuration using the frequency domain without the
use of guard bands.

Solution
Shift (modulate) each of the three voice channels to a
different bandwidth, as shown in Figure 6.6.

67
Figure 6.6 Example 1

68
Example 2
Five channels, each with a 100-KHz bandwidth, are to be
multiplexed together. What is the minimum bandwidth of
the link if there is a need for a guard band of 10 KHz
between the channels to prevent interference?

Solution
For five channels, we need at least four guard bands.
This means that the required bandwidth is at least
5 x 100 + 4 x 10 = 540 KHz,
as shown in Figure 6.7.

69
Figure 6.7 Example 2

70
Example 3
Four data channels (digital), each transmitting at 1 Mbps,
use a satellite channel of 1 MHz. Design an appropriate
configuration using FDM

Solution
The satellite channel is analog. We divide it into four
channels, each channel having a 250-KHz bandwidth.
Each digital channel of 1 Mbps is modulated such that
each 4 bits are modulated to 1 Hz. One solution is 16-
QAM modulation. Figure 6.8 shows one possible
configuration.
71
Figure 6.8 Example 3

72
Figure 6.9 Analog hierarchy

73
Example 4
The Advanced Mobile Phone System (AMPS) uses two
bands. The first band, 824 to 849 MHz, is used for
sending; and 869 to 894 MHz is used for receiving. Each
user has a bandwidth of 30 KHz in each direction. The 3-
KHz voice is modulated using FM, creating 30 KHz of
modulated signal. How many people can use their cellular
phones simultaneously?
Solution
Each band is 25 MHz. If we divide 25 MHz into 30 KHz,
we get 833.33. In reality, the band is divided into 832
channels.
74
6.2 WDM

Wave Division Multiplexing

75
Figure 6.10 WDM

76
Note:

WDM is an analog multiplexing


technique to combine
optical signals.

77
Figure 6.11 Prisms in WDM multiplexing and demultiplexing

78
6.3 TDM
Time Slots and Frames
Interleaving
Synchronizing
Bit Padding
Digital Signal (DS) Service
T Lines
Inverse TDM
More TDM Applications
79
Figure 6.12 TDM

80
Note:

TDM is a digital multiplexing


technique to combine data.

81
Figure 6.13 TDM frames

82
Example 5
Four 1-Kbps connections are multiplexed together. A unit
is 1 bit. Find (1) the duration of 1 bit before multiplexing,
(2) the transmission rate of the link, (3) the duration of a
time slot, and (4) the duration of a frame?
Solution
We can answer the questions as follows:

1. The duration of 1 bit is 1/1 Kbps, or 0.001 s (1 ms).


2. The rate of the link is 4 Kbps.
3. The duration of each time slot 1/4 ms or 250 ms.
4. The duration of a frame 1 ms.
83
Note:

In a TDM, the data rate of the link is n


times faster, and the unit duration is n
times shorter.

84
Figure 6.14 Interleaving

85
Example 6
Four channels are multiplexed using TDM. If each
channel sends 100 bytes/s and we multiplex 1 byte per
channel, show the frame traveling on the link, the size of
the frame, the duration of a frame, the frame rate, and the
bit rate for the link.

Solution
The multiplexer is shown in Figure 6.15.

86
Figure 6.15 Example 6

87
Example 7
A multiplexer combines four 100-Kbps channels using a
time slot of 2 bits. Show the output with four arbitrary
inputs. What is the frame rate? What is the frame
duration? What is the bit rate? What is the bit duration?

Solution
Figure 6.16 shows the output for four arbitrary inputs.

88
Figure 6.16 Example 7

89
Figure 6.17 Framing bits

90
Example 8

We have four sources, each creating 250 characters per


second. If the interleaved unit is a character and 1
synchronizing bit is added to each frame, find (1) the data
rate of each source, (2) the duration of each character in
each source, (3) the frame rate, (4) the duration of each
frame, (5) the number of bits in each frame, and (6) the
data rate of the link.

Solution

See next slide.


91
Solution (continued)

We can answer the questions as follows:

1. The data rate of each source is 2000 bps = 2 Kbps.


2. The duration of a character is 1/250 s, or 4 ms.
3. The link needs to send 250 frames per second.
4. The duration of each frame is 1/250 s, or 4 ms.
5. Each frame is 4 x 8 + 1 = 33 bits.
6. The data rate of the link is 250 x 33, or 8250 bps.

92
Example 9
Two channels, one with a bit rate of 100 Kbps and
another with a bit rate of 200 Kbps, are to be multiplexed.
How this can be achieved? What is the frame rate? What
is the frame duration? What is the bit rate of the link?
Solution
We can allocate one slot to the first channel and two slots
to the second channel. Each frame carries 3 bits. The
frame rate is 100,000 frames per second because it
carries 1 bit from the first channel. The frame duration is
1/100,000 s, or 10 ms. The bit rate is 100,000 frames/s x
3 bits/frame, or 300 Kbps.
93
Figure 6.18 DS hierarchy

94
Table 6.1 DS and T lines rates
Rate Voice
Service Line
(Mbps) Channels
DS-1 T-1 1.544 24

DS-2 T-2 6.312 96

DS-3 T-3 44.736 672

DS-4 T-4 274.176 4032

95
Figure 6.19 T-1 line for multiplexing telephone lines

96
Figure 6.20 T-1 frame structure

97
Table 6.2 E line rates
Rate Voice
E Line
(Mbps) Channels
E-1 2.048 30

E-2 8.448 120

E-3 34.368 480

E-4 139.264 1920

98
Figure 6.21 Multiplexing and inverse multiplexing

99
Client-Server
Model:
Socket Interface
100
24.1 Client-Server Model

Relationship

Concurrency

Processes

101
Figure 24.1 Client-server model

102
Figure 24.2 Client-server relationship

103
Figure 24.3 Connectionless iterative server

104
Figure 24.4 Connection-oriented concurrent server

105
24.2 Socket Interface

Sockets

Connectionless Iterative Server

Connection-Oriented Server

106
Figure 24.5 Socket structure

107
Figure 24.6 Socket types

108
Figure 24.7 Socket interface for connectionless iterative server

109
Figure 24.8 Socket interface for connection-oriented concurrent server

110
Congestion Control
and
Quality of Service
111
23.1 Data Traffic

Traffic Descriptor

Traffic Profiles

112
Figure 23.1 Traffic descriptors

113
Figure 23.2 Constant-bit-rate traffic

114
Figure 23.3 Variable-bit-rate traffic

115
Figure 23.4 Bursty traffic

116
23.2 Congestion

Network Performance

117
Figure 23.5 Incoming packet

118
Figure 23.6 Packet delay and network load

119
Figure 23.7 Throughput versus network load

120
23.3 Congestion Control

Open Loop

Closed Loop

121
23.4 Two Examples

Congestion Control in TCP

Congestion Control in Frame Relay

122
Note:

TCP assumes that the cause of a lost


segment is due to congestion
in the network.

123
Note:

If the cause of the lost segment is


congestion, retransmission of the
segment does not remove
the cause—it aggravates it.

124
Figure 23.8 Multiplicative decrease

125
Figure 23.9 BECN

126
Figure 23.10 FECN

127
Figure 23.11 Four cases of congestion

128
23.5 Quality of Service

Flow Characteristics

Flow Classes

129
23.6 Techniques to Improve QoS

Scheduling

Traffic Shaping

Resource Reservation

Admission Control

130
Figure 23.12 Flow characteristics

131
Figure 23.13 FIFO queue

132
Figure 23.14 Priority queuing

133
Figure 23.15 Weighted fair queuing

134
Figure 23.16 Leaky bucket

135
Figure 23.17 Leaky bucket implementation

136
Note:

A leaky bucket algorithm shapes


bursty traffic into fixed-rate traffic by
averaging the data rate. It may drop
the packets if the bucket is full.

137
Figure 23.18 Token bucket

138
Note:

The token bucket allows bursty traffic


at a regulated maximum rate.

139
23.7 Integrated Services

Signaling

Flow Specification

Admission

Service Classes

RSVP
140
Note:

Integrated Services is a flow-based


QoS model designed for IP.

141
Figure 23.19 Path messages

142
Figure 23.20 Resv messages

143
Figure 23.21 Reservation merging

144
Figure 23.22 Reservation styles

145

You might also like