CS 1302 Computer Networks — Unit - 4 — — Transport Layer — Text Book Behrouz .A. Forouzan, “Data communication and Networking”, Tata McGrawHill, 2004 4/9/2015 Unit-4 : Transport Layer 1 Transport Layer 4/9/2015 Unit-4 : Transport Layer 2 Position of transport layer 4/9/2015 Unit-4 : Transport Layer 3 Transport layer duties 4/9/2015 Unit-4 : Transport Layer 4 Chapters Chapter 22 Process-to-Process Delivery Chapter 23 Congestion Control and QoS 4/9/2015 Unit-4 : Transport Layer 5 Chapter 22 Process-to-Process Delivery: UDP and TCP 4/9/2015 Unit-4 : Transport Layer 6 22.1 Process-to-Process Delivery Client-Server Paradigm Addressing Multiplexing and Demultiplexing Connectionless/Connection-Oriented Reliable/Unreliable 4/9/2015 Unit-4 : Transport Layer 7 Note: The transport layer is responsible for process-to-process delivery. 4/9/2015 Unit-4 : Transport Layer 8 Figure 22.1 Types of data deliveries 4/9/2015 Unit-4 : Transport Layer 9 Figure 22.2 4/9/2015 Port numbers Unit-4 : Transport Layer 10 Figure 22.3 4/9/2015 IP addresses versus port numbers Unit-4 : Transport Layer 11 Figure 22.4 4/9/2015 IANA ranges Unit-4 : Transport Layer 12 Figure 22.5 4/9/2015 Socket address Unit-4 : Transport Layer 13 Figure 22.6 4/9/2015 Multiplexing and demultiplexing Unit-4 : Transport Layer 14 Figure 22.7 4/9/2015 Connection establishment Unit-4 : Transport Layer 15 Figure 22.8 4/9/2015 Connection termination Unit-4 : Transport Layer 16 Figure 22.9 4/9/2015 Error control Unit-4 : Transport Layer 17 22.2 UDP Port Numbers User Datagram Applications 4/9/2015 Unit-4 : Transport Layer 18 Note: UDP is a connectionless, unreliable protocol that has no flow and error control. It uses port numbers to multiplex data from the application layer. 4/9/2015 Unit-4 : Transport Layer 19 Table 22.1 Well-known ports used by UDP Port Protocol Description 7 Echo 9 Discard 11 Users 13 Daytime 17 Quote 19 Chargen 53 Nameserver 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) 4/9/2015 Echoes a received datagram back to the sender 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 Domain Name Service Unit-4 : Transport Layer 20 Figure 22.10 4/9/2015 User datagram format Unit-4 : Transport Layer 21 Note: The calculation of checksum and its inclusion in the user datagram are optional. 4/9/2015 Unit-4 : Transport Layer 22 Note: UDP is a convenient transport-layer protocol for applications that provide flow and error control. It is also used by multimedia applications. 4/9/2015 Unit-4 : Transport Layer 23 22.3 TCP Port Numbers Services Sequence Numbers Segments Connection Transition Diagram Flow and Error Control Silly Window Syndrome 4/9/2015 Unit-4 : Transport Layer 24 Table 22.2 Well-known ports used by TCP Port Protocol Description 7 Echo 9 Discard 11 Users 13 Daytime 17 Quote 19 Chargen 20 FTP, Data 21 FTP, Control 23 TELNET 25 SMTP 53 DNS 67 BOOTP 79 Finger Finger 80 HTTP Hypertext Transfer Protocol 111 RPC 4/9/2015 Echoes a received datagram back to the sender 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 Remote Procedure Call Unit-4 : Transport Layer 25 Figure 22.11 Stream delivery 4/9/2015 Unit-4 : Transport Layer 26 Figure 22.12 4/9/2015 Sending and receiving buffers Unit-4 : Transport Layer 27 Figure 22.13 TCP segments 4/9/2015 Unit-4 : Transport Layer 28 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 Segment 1 ==> Segment 2 ==> Segment 3 ==> Segment 4 ==> Segment 5 ==> 4/9/2015 the sequence number for each segment: sequence number: 10,010 (range: 10,010 sequence number: 11,010 (range: 11,010 sequence number: 12,010 (range: 12,010 sequence number: 13,010 (range: 13,010 sequence number: 14,010 (range: 14,010 Unit-4 : Transport Layer to 11,009) to 12,009) to 13,009) to 14,009) to 16,009) 29 Note: The bytes of data being transferred in each connection are numbered by TCP. The numbering starts with a randomly generated number. 4/9/2015 Unit-4 : Transport Layer 30 Note: The value of the sequence number field in a segment defines the number of the first data byte contained in that segment. 4/9/2015 Unit-4 : Transport Layer 31 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. 4/9/2015 Unit-4 : Transport Layer 32 Figure 22.14 TCP segment format 4/9/2015 Unit-4 : Transport Layer 33 Figure 22.15 4/9/2015 Control field Unit-4 : Transport Layer 34 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. 4/9/2015 Unit-4 : Transport Layer 35 Figure 22.16 Three-step connection establishment 4/9/2015 Unit-4 : Transport Layer 36 Figure 22.17 4/9/2015 Four-step connection termination Unit-4 : Transport Layer 37 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. 4/9/2015 LAST-ACK Unit-4 : Transport Layer The server is waiting for the last acknowledgment. 38 Figure 22.18 4/9/2015 State transition diagram Unit-4 : Transport Layer 39 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. 4/9/2015 Unit-4 : Transport Layer 40 Figure 22.19 4/9/2015 Sender buffer Unit-4 : Transport Layer 41 Figure 22.20 4/9/2015 Receiver window Unit-4 : Transport Layer 42 Figure 22.21 4/9/2015 Sender buffer and sender window Unit-4 : Transport Layer 43 Figure 22.22 4/9/2015 Sliding the sender window Unit-4 : Transport Layer 44 Figure 22.23 4/9/2015 Expanding the sender window Unit-4 : Transport Layer 45 Figure 22.24 4/9/2015 Shrinking the sender window Unit-4 : Transport Layer 46 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. 4/9/2015 Unit-4 : Transport Layer 47 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. 4/9/2015 Unit-4 : Transport Layer 48 Figure 22.25 4/9/2015 Lost segment Unit-4 : Transport Layer 49 Figure 22.26 4/9/2015 Lost acknowledgment Unit-4 : Transport Layer 50 Figure 22.27 TCP timers 4/9/2015 Unit-4 : Transport Layer 51 Multiplexing 4/9/2015 Unit-4 : Transport Layer 52 Figure 6.1 4/9/2015 Dividing a link into channels Unit-4 : Transport Layer 53 Figure 6.2 4/9/2015 Categories of multiplexing Unit-4 : Transport Layer 54 6.1 FDM Multiplexing Process Demultiplexing Process The Analog Hierarchy Other Applications of FDM Implementation 4/9/2015 Unit-4 : Transport Layer 55 Figure 6.3 4/9/2015 FDM Unit-4 : Transport Layer 56 Note: FDM is an analog multiplexing technique that combines signals. 4/9/2015 Unit-4 : Transport Layer 57 Figure 6.4 4/9/2015 FDM process Unit-4 : Transport Layer 58 Figure 6.5 4/9/2015 FDM demultiplexing example Unit-4 : Transport Layer 59 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. 4/9/2015 Unit-4 : Transport Layer 60 Figure 6.6 4/9/2015 Example 1 Unit-4 : Transport Layer 61 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. 4/9/2015 Unit-4 : Transport Layer 62 Figure 6.7 4/9/2015 Example 2 Unit-4 : Transport Layer 63 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 16QAM modulation. Figure 6.8 shows one possible configuration. 4/9/2015 Unit-4 : Transport Layer 64 Figure 6.8 4/9/2015 Example 3 Unit-4 : Transport Layer 65 Figure 6.9 4/9/2015 Analog hierarchy Unit-4 : Transport Layer 66 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 3KHz 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. 4/9/2015 Unit-4 : Transport Layer 67 6.2 WDM Wave Division Multiplexing 4/9/2015 Unit-4 : Transport Layer 68 Figure 6.10 4/9/2015 WDM Unit-4 : Transport Layer 69 Note: WDM is an analog multiplexing technique to combine optical signals. 4/9/2015 Unit-4 : Transport Layer 70 Figure 6.11 Prisms in WDM multiplexing and demultiplexing 4/9/2015 Unit-4 : Transport Layer 71 6.3 TDM Time Slots and Frames Interleaving Synchronizing Bit Padding Digital Signal (DS) Service T Lines Inverse TDM More TDM Applications 4/9/2015 Unit-4 : Transport Layer 72 Figure 6.12 4/9/2015 TDM Unit-4 : Transport Layer 73 Note: TDM is a digital multiplexing technique to combine data. 4/9/2015 Unit-4 : Transport Layer 74 Figure 6.13 4/9/2015 TDM frames Unit-4 : Transport Layer 75 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. 4/9/2015 Unit-4 : Transport Layer 76 Note: In a TDM, the data rate of the link is n times faster, and the unit duration is n times shorter. 4/9/2015 Unit-4 : Transport Layer 77 Figure 6.14 4/9/2015 Interleaving Unit-4 : Transport Layer 78 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. 4/9/2015 Unit-4 : Transport Layer 79 Figure 6.15 4/9/2015 Example 6 Unit-4 : Transport Layer 80 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. 4/9/2015 Unit-4 : Transport Layer 81 Figure 6.16 4/9/2015 Example 7 Unit-4 : Transport Layer 82 Figure 6.17 4/9/2015 Framing bits Unit-4 : Transport Layer 83 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. 4/9/2015 Unit-4 : Transport Layer 84 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. 4/9/2015 Unit-4 : Transport Layer 85 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. 4/9/2015 Unit-4 : Transport Layer 86 Figure 6.18 4/9/2015 DS hierarchy Unit-4 : Transport Layer 87 Table 6.1 DS and T lines rates 4/9/2015 Service Line Rate (Mbps) Voice 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 Unit-4 : Transport Layer 88 Figure 6.19 4/9/2015 T-1 line for multiplexing telephone lines Unit-4 : Transport Layer 89 Figure 6.20 4/9/2015 T-1 frame structure Unit-4 : Transport Layer 90 Table 6.2 E line rates 4/9/2015 E Line Rate (Mbps) Voice Channels E-1 2.048 30 E-2 8.448 120 E-3 34.368 480 E-4 139.264 1920 Unit-4 : Transport Layer 91 Figure 6.21 4/9/2015 Multiplexing and inverse multiplexing Unit-4 : Transport Layer 92 Client-Server Model: Socket Interface 4/9/2015 Unit-4 : Transport Layer 93 24.1 Client-Server Model Relationship Concurrency Processes 4/9/2015 Unit-4 : Transport Layer 94 Figure 24.1 4/9/2015 Client-server model Unit-4 : Transport Layer 95 Figure 24.2 4/9/2015 Client-server relationship Unit-4 : Transport Layer 96 Figure 24.3 4/9/2015 Connectionless iterative server Unit-4 : Transport Layer 97 Figure 24.4 4/9/2015 Connection-oriented concurrent server Unit-4 : Transport Layer 98 24.2 Socket Interface Sockets Connectionless Iterative Server Connection-Oriented Server 4/9/2015 Unit-4 : Transport Layer 99 Figure 24.5 4/9/2015 Socket structure Unit-4 : Transport Layer 100 Figure 24.6 4/9/2015 Socket types Unit-4 : Transport Layer 101 Figure 24.7 4/9/2015 Socket interface for connectionless iterative server Unit-4 : Transport Layer 102 Figure 24.8 4/9/2015 Socket interface for connection-oriented concurrent server Unit-4 : Transport Layer 103 Congestion Control and Quality of Service 4/9/2015 Unit-4 : Transport Layer 104 23.1 Data Traffic Traffic Descriptor Traffic Profiles 4/9/2015 Unit-4 : Transport Layer 105 Figure 23.1 Traffic descriptors 4/9/2015 Unit-4 : Transport Layer 106 Figure 23.2 4/9/2015 Constant-bit-rate traffic Unit-4 : Transport Layer 107 Figure 23.3 Variable-bit-rate traffic 4/9/2015 Unit-4 : Transport Layer 108 Figure 23.4 4/9/2015 Bursty traffic Unit-4 : Transport Layer 109 23.2 Congestion Network Performance 4/9/2015 Unit-4 : Transport Layer 110 Figure 23.5 4/9/2015 Incoming packet Unit-4 : Transport Layer 111 Figure 23.6 4/9/2015 Packet delay and network load Unit-4 : Transport Layer 112 Figure 23.7 Throughput versus network load 4/9/2015 Unit-4 : Transport Layer 113 23.3 Congestion Control Open Loop Closed Loop 4/9/2015 Unit-4 : Transport Layer 114 23.4 Two Examples Congestion Control in TCP Congestion Control in Frame Relay 4/9/2015 Unit-4 : Transport Layer 115 Note: TCP assumes that the cause of a lost segment is due to congestion in the network. 4/9/2015 Unit-4 : Transport Layer 116 Note: If the cause of the lost segment is congestion, retransmission of the segment does not remove the cause—it aggravates it. 4/9/2015 Unit-4 : Transport Layer 117 Figure 23.8 4/9/2015 Multiplicative decrease Unit-4 : Transport Layer 118 Figure 23.9 4/9/2015 BECN Unit-4 : Transport Layer 119 Figure 23.10 4/9/2015 FECN Unit-4 : Transport Layer 120 Figure 23.11 Four cases of congestion 4/9/2015 Unit-4 : Transport Layer 121 23.5 Quality of Service Flow Characteristics Flow Classes 4/9/2015 Unit-4 : Transport Layer 122 23.6 Techniques to Improve QoS Scheduling Traffic Shaping Resource Reservation Admission Control 4/9/2015 Unit-4 : Transport Layer 123 Figure 23.12 4/9/2015 Flow characteristics Unit-4 : Transport Layer 124 Figure 23.13 4/9/2015 FIFO queue Unit-4 : Transport Layer 125 Figure 23.14 4/9/2015 Priority queuing Unit-4 : Transport Layer 126 Figure 23.15 Weighted fair queuing 4/9/2015 Unit-4 : Transport Layer 127 Figure 23.16 4/9/2015 Leaky bucket Unit-4 : Transport Layer 128 Figure 23.17 4/9/2015 Leaky bucket implementation Unit-4 : Transport Layer 129 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. 4/9/2015 Unit-4 : Transport Layer 130 Figure 23.18 Token bucket 4/9/2015 Unit-4 : Transport Layer 131 Note: The token bucket allows bursty traffic at a regulated maximum rate. 4/9/2015 Unit-4 : Transport Layer 132 23.7 Integrated Services Signaling Flow Specification Admission Service Classes RSVP 4/9/2015 Unit-4 : Transport Layer 133 Note: Integrated Services is a flow-based QoS model designed for IP. 4/9/2015 Unit-4 : Transport Layer 134 Figure 23.19 4/9/2015 Path messages Unit-4 : Transport Layer 135 Figure 23.20 4/9/2015 Resv messages Unit-4 : Transport Layer 136 Figure 23.21 4/9/2015 Reservation merging Unit-4 : Transport Layer 137 Figure 23.22 4/9/2015 Reservation styles Unit-4 : Transport Layer 138