52
1 Kyung Hee University Chapter 13 Chapter 13 Introduction Introduction to the to the Transport Transport Layer Layer

Chapter 13 Introduction to the Transport Layer

Embed Size (px)

DESCRIPTION

13.1 Transport-Layer Services Process-to-Process Communication Addressing : Port Numbers Encapsulation and Decapsulation Multiplexing and Demultiplexing Flow Control Error Control Congestion Control Connectionless and Connection-Oriented Services

Citation preview

Page 1: Chapter 13 Introduction to the Transport Layer

11Kyung Hee University

Chapter 13 Chapter 13 Introduction to Introduction to the Transport the Transport

LayerLayer

Page 2: Chapter 13 Introduction to the Transport Layer

22Kyung Hee University

13.1 Transport-Layer Services13.1 Transport-Layer Services

Process-to-Process Communication

Addressing : Port Numbers

Encapsulation and Decapsulation

Multiplexing and Demultiplexing

Flow Control

Error Control

Congestion Control

Connectionless and Connection-Oriented Services

Page 3: Chapter 13 Introduction to the Transport Layer

33Kyung Hee University

Process-to-Process CommunicationProcess-to-Process Communication

Process is an application-layer entity

Responsible for delivery of the message to the appropriate process

Page 4: Chapter 13 Introduction to the Transport Layer

44Kyung Hee University

Addressing : Port NumberAddressing : Port Number

Client-server paradigm : the most common way to achieve process-to-process communication

Process on local host needs service from a process on the remote host

Both processes have the same name : Daytime process

To support several program at the same time, we must define

Local host

Local process

Remote host

Remote process

Page 5: Chapter 13 Introduction to the Transport Layer

55Kyung Hee University

Addressing : Port NumberAddressing : Port Number

To define the hosts, we use IP addresses

To define the processes, we need second identifiers

Port number

In the TCP/IP protocol suite, port numbers are integers between 0 and 65,535

Ephemeral port number

Recommended to be greater than 1,023

Well-known port number

Universal port numbers for servers

Page 6: Chapter 13 Introduction to the Transport Layer

66Kyung Hee University

Port NumbersPort Numbers

Page 7: Chapter 13 Introduction to the Transport Layer

77Kyung Hee University

IP Addresses versus Port NumbersIP Addresses versus Port Numbers

Page 8: Chapter 13 Introduction to the Transport Layer

88Kyung Hee University

ICANN RangesICANN Ranges

Well-known ports : 0 ~ 1,023

Assigned and controlled by ICANN

Registered ports : 1,024 ~ 49,151

Not assigned and controlled by ICANN

Can be registered with ICANN to prevent duplication

Dynamic ports : 49,152 ~ 65,535

Can be used as temporary or private port number

Page 9: Chapter 13 Introduction to the Transport Layer

99Kyung Hee University

Example 13.1Example 13.1

In UNIX, the well-known ports are stored in a file called /etc/services. Each line in this file gives the name of the server and the well-known port number. We can use the grep utility to extract the line corresponding to the desired application. The following shows the port for TFTP. Note that TFTP can use port 69 on either UDP or TCP. SNMP uses two port numbers (161 and 162), each for a different purpose.

Page 10: Chapter 13 Introduction to the Transport Layer

1010Kyung Hee University

Socket AddressSocket Address

The combination of an IP address and a port number

Page 11: Chapter 13 Introduction to the Transport Layer

1111Kyung Hee University

Encapsulation and DecapsulationEncapsulation and Decapsulation Encapsulation

Happen at the sender site

Add the transport-layer header

Decapsulation

Happen at the receiver site

The header is dropped

Page 12: Chapter 13 Introduction to the Transport Layer

1212Kyung Hee University

Mutiplexing and DemultiplexingMutiplexing and Demultiplexing

Multiplexing

Entity accepts items frommore than one source

Demultiplexing

Entity deliver items to morethan one source

Page 13: Chapter 13 Introduction to the Transport Layer

1313Kyung Hee University

Flow ControlFlow Control

Balance between production and consumption rates

Delivery of items from a producer to a consumer

Pushing : sender delivers items whenever they produced

Pulling : producer delivers the items after the consumer has requested

Page 14: Chapter 13 Introduction to the Transport Layer

1414Kyung Hee University

Flow Control at the Transport LayerFlow Control at the Transport Layer

One of solutions for flow control is normally to use buffers

Page 15: Chapter 13 Introduction to the Transport Layer

1515Kyung Hee University

Error ControlError Control

Detect and discard corrupted packets.

Keep track of lost and discarded packets and resend them.

Recognize duplicate packets and discard them.

Buffer out-of-order packets until the missing packets arrive.

Page 16: Chapter 13 Introduction to the Transport Layer

1616Kyung Hee University

Error ControlError Control

Sequence Number

Which packet is to be resent

Which packet is a duplicate

Which packet has arrived out of order

This can be done if the packets are numbered

Acknowledgment

The receiver side can send an acknowledgement for each or a collection of packets that have arrived safe and sound

Page 17: Chapter 13 Introduction to the Transport Layer

1717Kyung Hee University

Combination of Flow and Error ControlCombination of Flow and Error Control

Flow control requires the use of two buffers, one at sender site and other at the receiver site.

Error control requires the use of sequence and acknowledgment number by both sides.

Sliding window

Page 18: Chapter 13 Introduction to the Transport Layer

1818Kyung Hee University

Sliding window in circular formatSliding window in circular format

Page 19: Chapter 13 Introduction to the Transport Layer

1919Kyung Hee University

Sliding window in linear formatSliding window in linear format

Page 20: Chapter 13 Introduction to the Transport Layer

2020Kyung Hee University

Congestion ControlCongestion ControlOccur if the load on the network is greater than the

capacity of the network

Open-loop congestion control :prevent congestion before it happens

Retransmission policy : using retransmission timer

Window policy : selective repeat and go-back-N window

Acknowledgment policy : using timer, a ACK for N packets

Closed-loop congestion control

alleviating congestion after it happens

Flexible window size

Page 21: Chapter 13 Introduction to the Transport Layer

2121Kyung Hee University

Connectionless and Connection-Oriented ServiceConnectionless and Connection-Oriented Service

Connectionless service

Divide messages into chunks of data

No dependency between the packets

The packets may arrive out of order

Connection-oriented service

Establish a connection between a server and a client.

After data exchange, the connection needs to be teared down

Page 22: Chapter 13 Introduction to the Transport Layer

2222Kyung Hee University

Connectionless ServiceConnectionless Service

Page 23: Chapter 13 Introduction to the Transport Layer

2323Kyung Hee University

Connection-Oriented ServiceConnection-Oriented Service

Connection-closerequest

Page 24: Chapter 13 Introduction to the Transport Layer

2424Kyung Hee University

13.2 Transport-Layer Protocols13.2 Transport-Layer Protocols

Simple connectionless protocol

No flow control and error control

Connection-oriented protocol

Stop-and-Wait protocol Provide flow and error control

Go-Back-N protocol Efficient version of Stop-and-Wait protocol

Selective-Repeat Protocol Suited to handle packet loss

Piggybacking

Page 25: Chapter 13 Introduction to the Transport Layer

2525Kyung Hee University

Simple ProtocolSimple Protocol

No flow nor error control based connectionless protocol

Page 26: Chapter 13 Introduction to the Transport Layer

2626Kyung Hee University

Example 13.3Example 13.3

Figure 13.18 shows an example of communication using the protocol. It is very simple. The sender sends packets one after another without even thinking about the receiver.

Page 27: Chapter 13 Introduction to the Transport Layer

2727Kyung Hee University

Stop-and-Wait ProtocolStop-and-Wait Protocol

Use both flow and error controlBoth the sender and the receiver use a sliding window of size 1.

The sender sends one packet and waits for an ACK before sending the next one.

Add a checksum to detect corrupted packets

When sender sends a packet, it starts a timerIf an ACK arrives, timer is stopped

Either the packet was lost or corrupted, the sender resends the previous packet

Page 28: Chapter 13 Introduction to the Transport Layer

2828Kyung Hee University

Stop-and-Wait ProtocolStop-and-Wait Protocol

Page 29: Chapter 13 Introduction to the Transport Layer

2929Kyung Hee University

Stop-and-Wait ProtocolStop-and-Wait Protocol

Sequence Number

To prevent duplicate packets

A field is added to the packet header to hold the sequence number

Use x as a sequence number, x+1 as a acknowledgment number

Acknowledgement number

Sequence number of the next packet expected by the receiver

Page 30: Chapter 13 Introduction to the Transport Layer

3030Kyung Hee University

Example 13.4Example 13.4

Following figure shows an example of Sop-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.

Page 31: Chapter 13 Introduction to the Transport Layer

3131Kyung Hee University

Flow Diagram for Example 13.4Flow Diagram for Example 13.4

Page 32: Chapter 13 Introduction to the Transport Layer

3232Kyung Hee University

Go-Back-N ProtocolGo-Back-N Protocol

To improve the efficiency of transmission, we can send several packets before receiving acknowledgments.

Page 33: Chapter 13 Introduction to the Transport Layer

3333Kyung Hee University

Send Window for Go-Back-NSend Window for Go-Back-N

The send window is an abstract concept defining an imaginary box of maximum size = 2m-1 with three variable : sf, sn, and ssize.

The send window can slide one or more slot when an error-free ACK with ackNo between Sf and Sn arrives.

Page 34: Chapter 13 Introduction to the Transport Layer

3434Kyung Hee University

Sliding the send windowSliding the send window

Page 35: Chapter 13 Introduction to the Transport Layer

3535Kyung Hee University

Receive Window for Go-Back-NReceive Window for Go-Back-N

The receive window is an abstract concept defining an imaginary box of size 1 with one single variable Rn.

The window slides when a correct packet has arrived: sliding occurs one slot at a time.

Page 36: Chapter 13 Introduction to the Transport Layer

3636Kyung Hee University

Send Window Size for Go-Back-NSend Window Size for Go-Back-N

In the Go-Back-N protocol, the size of the send window must be less than 2m; the size of the receive window is always 1.

Page 37: Chapter 13 Introduction to the Transport Layer

3737Kyung Hee University

Example 13.7Example 13.7

Following figure shows an example of Go-Back-N. This is an example of a case where the forward channel is reliable, but the reverse is not. No data packets are lost, but some ACKs are delayed and one is lost. The example also shows how cumulative acknowledgements can help if acknowledgements are delayed of lost.

Page 38: Chapter 13 Introduction to the Transport Layer

3838Kyung Hee University

Flow Diagram for Example 13.7Flow Diagram for Example 13.7

Page 39: Chapter 13 Introduction to the Transport Layer

3939Kyung Hee University

Example 13.8Example 13.8

Following figure shows what happen when a packet is lost. Packets 0, 1, 2, and 3 are sent. However, packet 1 is lost. The receiver receives packets 2 and 3, but they are discarded because they are received out of order. When the receiver receives packets 2 and 3, it send ACK 1 to show that it expects to receive packet 1. However, these ACKs are nor useful for the sender because the ackNo is equal Sf, not greater that Sf. So the sender discards them. When the time-out occur, the sender resends packets 1, 2, and 3, which are acknowledged.

Page 40: Chapter 13 Introduction to the Transport Layer

4040Kyung Hee University

Flow Diagram for Example 13.8Flow Diagram for Example 13.8

Page 41: Chapter 13 Introduction to the Transport Layer

4141Kyung Hee University

Selective-Repeat ProtocolSelective-Repeat Protocol

The Go-Back-N protocol simplifies the process of receiver

No need to buffer out-of-order packets

Inefficient when the underlying network protocol loses a lot of packets

SR(Selective-Repeat) protocol devised above.

Resend only selective packets

Page 42: Chapter 13 Introduction to the Transport Layer

4242Kyung Hee University

Outline of Selective-RepeatOutline of Selective-Repeat

Page 43: Chapter 13 Introduction to the Transport Layer

4343Kyung Hee University

Send Window for Selective-Repeat protocolSend Window for Selective-Repeat protocol

Page 44: Chapter 13 Introduction to the Transport Layer

4444Kyung Hee University

Receive Window for Selective-Repeat protocolReceive Window for Selective-Repeat protocol

Page 45: Chapter 13 Introduction to the Transport Layer

4545Kyung Hee University

Example 13.9Example 13.9

Assume a sender sends 6 packets: packets 0, 1, 2, 3, 4, and 5. The sender receives an ACK with ackNo=3. What is the interpretation if the system is using GBN or SR ?

Solution

If the system is using GBN, it means that packet 0, 1, and 2 have been received uncorrupted and the receiver is expecting packet 3. in using SR, it means that packet 3 has been received uncorrupted; the ACK does not say anything about other pakcets.

Page 46: Chapter 13 Introduction to the Transport Layer

4646Kyung Hee University

Example 13.10Example 13.10

This example is similar to Example 3.8 in which packet 1 is lost. We show how Selective-Repeat behave in this case. Figure 13.34 shows the situation.

At the sender, packet 0 is transmitted and acknowledged. Packet 1 is lost. Packet 2 and 3 arrive out of order and are acknowledged. When the timer times out, packet 1 is resent and is acknowledged. The send window then slides.

Page 47: Chapter 13 Introduction to the Transport Layer

4747Kyung Hee University

Flow Diagram of 13.10Flow Diagram of 13.10

Page 48: Chapter 13 Introduction to the Transport Layer

4848Kyung Hee University

Selective-Repeat Window SizeSelective-Repeat Window Size

Page 49: Chapter 13 Introduction to the Transport Layer

4949Kyung Hee University

Bidirectional Protocols : PiggybackingBidirectional Protocols : Piggybacking

Previous protocols are unidirectional

Data packets flow in only one direction and acknowledgement travel in the other direction

In real life, data flow and acknowledgement need to flow in both direction.

Piggybacking is used to improved the efficiency of the bidirectional protocols

When a packet is carrying data from A to B, it can also carry acknowledgement feedback about arrived packets from B

Page 50: Chapter 13 Introduction to the Transport Layer

5050Kyung Hee University

Design of Piggybacking in Go-Back-NDesign of Piggybacking in Go-Back-N

Page 51: Chapter 13 Introduction to the Transport Layer

5151Kyung Hee University

Summary(1)Summary(1) The main duty of a transport-layer protocol is to provide process-to-process

communication. To define the processes, we need port number. The client program defines itself with an ephemeral port number. The server defines itself with a well-known port number.

To send a message from one process to another, the transport layer protocol encapsulates and decapsulates messages. Encapsulation happens at the sender site. Decapsulation happens at the receiver site.

The transport layer at the source perform multiplexing, collecting messages from server processes for transmission; the transport layer at the destination performs demultiplexing, delivering messages to different processes.

Flow control balances the exchange of data items between a producer and a consumer. At the transport layer, we use buffers to hold packets when the consumer is not ready to accept them. Reliability at the transport layer can be achieved by adding error control, which includes detection of corrupted packets, reordering packets that arrived out of order. To manage flow and error control, we use sequence numbers to number packets and use acknowledgement numbers to refer to the numbered packets.

Page 52: Chapter 13 Introduction to the Transport Layer

5252Kyung Hee University

Summary(2)Summary(2) A transport layer can provide two types of congestion control: open-loop and

closed-loop. In an open-loop congestion control, the protocol tries to avoid the congestion; in closed-loop congestion control, the protocol tries to detect and remove the congestion after it occurred.

A transport-layer protocol can provide two types of services: connectionless and connection-oriented. In a connectionless service, the sender sends packets to the receiver without any connection establishment. In a connection-oriented service, the client and the server first need to establish a connection between themselves. The data exchange can only happen after the connection establishment. After data exchange, the connection needs to be torn down.

We have discussed several common transport-layer protocols in this chapter. The simple connectionless protocol provides neither flow control nor error control. The connection-oriented Stop-and-Wait protocol provides both flow and error control, but is inefficient. The Go-Back-N protocol is more efficient version of the Stop-and-Wait protocol that takes advantage of pipelining. The Selective-Repeat protocol is a modification of the Go-Back-N protocol that is better suited to handle packet loss. All of these protocol can be implemented bidirectionally using piggybacking.