CS计算机代考程序代写 3.1 .

3.1 .
Chapter 3
Part 1: Transport Layer
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.2
Chapter 3: Outline
3.1 INTRODUCTION
3.2 TRANSPORT-LAYER PROTOCOLS
3.3 USER DATAGRAM PROTOCOL
3.4 TRANSMISSION CONTROL PROTOCOL
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.3
Chapter 3: Objective
We introduce general services we normally require from the transport layer, such as
• process-to-process communication,
• addressing,
• Multiplexing
• error, flow, and
• congestion control.
 We discuss general transport-layer flow control protocols such as
• Stop-and-Wait,
• Go-Back-N, and • Selective-Repeat.
 We discuss UDP, which is the simpler protocols than TCP
We discuss TCP services and features. We then show how TCP
provides a connection-oriented service using a transition diagram.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3

1 INTRODUCTION
3.4
• The transport layer provides a process-to-process communication between two application layers.
• Communication is provided using a logical connection
• which means that the two application layers assume that there is an imaginary direct connection through which they can send and receive messages.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.1: Logical connection at the transport layer
3.5
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.6
3.1.1 Transport-Layer Services
• As discussed the transport layer is located between the network layer and the application layer.
• The transport layer is responsible for providing services to the application layer;
• it receives services from the network layer.
• In this section, we discuss the services that can be
provided by the transport layer;
• in the next section, we discuss several transport- layer protocols.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.1.1 (continued)
Process-to-Process Communication
Addressing: Port Numbers
ICANN Ranges
 Well-known ports  Registered ports  Dynamic ports
Encapsulation and Decapsulation
Multiplexing and Demultiplexing
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
3.7

3.8
3.1.1 (continued)
Flow Control
 Pushing or Pulling
 Flow Control at Transport Layer  Buffers
Error Control
 Sequence Numbers
 Acknowledgment
Combination of Flow and Error Control  Sliding Window
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.9
3.1.1 (continued)
Congestion Control
Connectionless and Connection-Oriented
 Connectionless Service
 Connection-Oriented Service  Finite State Machine
Multiplexing and Demultiplexing
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.2: Network layer versus transport layer
3.10
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.3: Port numbers
3.11
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.12
Figure 3.4: IP addresses versus port numbers
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.5: ICANN ranges
3.13
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Example 3.1
In UNIX, the well-known ports are stored in a file called /etc/services. We can use the grep utility to extract the line corresponding to the desired application.
SNMP (see Chapter 9) uses two port numbers (161 and 162), each for a different purpose.
3.14
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.6: Socket address
3.15
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.7: Encapsulation and decapsulation
3.16
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.8: Multiplexing and de-multiplexing
Multiplexing and de-multiplexing in transport layer means extending the host-to-host delivery service provided by the network layer to a process-to-process delivery service for applications running on the hosts.
3.17
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.9: Pushing or pulling
3.18
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.10: Flow control at the transport layer
3.19
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Example 3.2
3.20
 The above discussion requires that the consumers communicate with the producers on two occasions:
 when the buffer is full and when there are vacancies.
 If the two parties use a buffer with only one slot, the
communication can be easier.
Assume that each transport layer uses one single memory location to hold a packet. When this single slot in the sending transport layer is empty, the sending transport layer sends a note to the application layer to send its next chunk; when this single slot in the receiving transport layer is empty, it sends an acknowledgment to the sending transport layer to send its next packet.
 As we will see later, however, this type of flow control, using a single-slot buffer at the sender and the receiver, is inefficient.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.11: Error control at the transport layer
3.21
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.12: Sliding window in circular format
3.22
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.13: Sliding window in linear format
3.23
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.14: Connectionless service
3.24
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.15: Connection-oriented service
Packet 2
3.25
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3

2 TRANSPORT

LAYER PROTOCOLS
3.26
• We can create a transport-layer protocol by combining a set of services described in the previous sections.
• To better understand the behavior of these protocols, we start with the simplest one and gradually add more complexity.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.2.1 Simple Protocol
Our first protocol is a simple connectionless protocol with neither flow nor error control. We assume that the receiver can immediately handle any packet it receives. In other words, the receiver can never be overwhelmed with incoming packets. Figure 3.17 shows the layout for this protocol.
Figure 3.17: Simple protocol
Figure 3.18: FSMs for the simple protocol
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
3.27

Figure 3.19: Flow diagram for Example 3.3
Example 3.3: Figure 3.19 shows an example of communication using this protocol. It is very
simple. The sender sends packets one after another without even thinking about the receiver.
3.28
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.2.2 Stop-and-Wait Protocol
• Our second protocol is a connection-oriented protocol called the Stop-
and-Wait protocol, which uses both flow and error control.
• Both the sender and the receiver use a sliding window of size 1.
• The sender sends one packet at a time and waits for an acknowledgment before sending the next one.
• To detect corrupted packets, we need to add a checksum to each data packet. When a packet arrives at the receiver site,
 Sequence Numbers
 Acknowledgment Numbers
 Efficiency  Pipelining
3.29
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.20: Stop-and-Wait protocol
3.30
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.22: Flow diagram for Example 3.4
• Figure 3.22 shows an example
of the Stop-and-Wait protocol.
• Packet 0 is sent and acknowledged.
• Packet 1 is lost and resent after the time-out.
• The resent packet 1 is acknowledged and the timer stops.
• Packet 0 is sent and acknowledged, but the acknowledgment is lost.
• The sender has no idea if the packet or the acknowledgment is lost, so after the time-out, it resends packet 0, which is acknowledged.
3.31
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Example 3.5
Problem: Assume that, in a Stop-and-Wait system, the bandwidth of the line is 1 Mbps, and 1 bit takes 20 milliseconds to make a round trip. What is the bandwidth-delay product?
If the system data packets are 1,000 bits in length, what is the utilization percentage of the link?
Solution
The bandwidth-delay product is
= BW × Delay = (1 × 106) × (20 × 10−3) = 20,000 bits.
The system can send 20,000 bits during the time it takes for the data to go from the sender to the receiver and the acknowledgment to come back.
However, the system sends only 1,000 bits. The link utilization is only 1,000/20,000 == 5 percent.
3.32
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Example 3.6
Problem: What is the utilization percentage of the link in Example 3.5 if we have a protocol that can send up to 15 packets before stopping and worrying about the acknowledgments?
Solution
The bandwidth-delay product is still the same;
= BW × Delay = (1 × 106) × (20 × 10−3) = 20,000 bits.
Now the system can send up to 15 packets or 15 x 1000 = 15,000 bits during a round trip.
This means the utilization is now 15,000/20,000, or 75 percent. Of course, if there are damaged packets, the utilization percentage is much less because packets have to be resent.
3.33
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.34
3.2.3 Go-Back-N Protocol
To improve the efficiency of transmission multiple packets must be in transition while the sender is waiting for acknowledgment.
In this section, we discuss one protocol that can achieve this goal; in the next section,
we discuss a second. The first is called Go-Back-N (GBN) (the rationale for the name will become clear later).
 Sequence Numbers
 Acknowledgment Numbers
 Send Window
 Receive Window
 Timers
 Resending packets
 Send Window Size
 Go-Back-N versus Stop-and-Wait
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.24: Send window for Go-Back-N
3.35
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.25: Sliding the send window
Sliding direction
3.36
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.28: Send window size for Go-Back-N
3.37
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.38
Figure 3.29: Flow diagram for Example 3.7
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.39
Figure 3.30: Flow diagram for Example 3.8
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.40
3.2.4 Selective-Repeat Protocol
• The Go-Back-N protocol simplifies the process at the receiver.
• The receiver keeps track of only one variable, and there is no need to buffer out-of-order packets; they are simply discarded.
• Another protocol, called the Selective-Repeat (SR) protocol, has been devised.
• Selective-Repeat (SR) protocol, as the name implies, resends only selective packets, those that are actually lost.
• The outline of this protocol is shown in Figure 3.31.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.41
Figure 3.35: Flow diagram for Example 3.10
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.36: Selective-Repeat, window size
3.42
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.43
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.44
3.2.5 Bidirectional Protocols
• The previous four protocols discussed earlier were all unidirectional;
• Data packets flow in only one direction and acknowledgments travel in the other direction.
• In real systems, data packets are normally flowing in both directions: from client to server and from server to client.
• This means that acknowledgments are also need to flow in both directions.
• A technique called piggybacking is used to improve the efficiency of the bidirectional protocols.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.37: Design of piggybacking in Go-Back-N
3.45
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.46
3.2.6 Internet Transport-Layer Protocols
• A network is the interconnection of a set of devices capable of communication.
• In this definition, a device can be a host such as a large computer, desktop, laptop, workstation, cellular phone, or security system.
• A device in this definition can also be a connecting device such as a router a switch, a modem that changes the form of data, and so on.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Figure 3.38: Position of transport-layer protocols in the TCP/IP protocol suite
3.47
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Table 3.1: Some well-known ports used with UDP and TCP
3.48
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

3.49
Transport Layer End part-1
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.