part v. transport layer

36
Fall 2005 Computer Networks 22-1 PART V. Transport Layer

Upload: echo-mcguire

Post on 03-Jan-2016

22 views

Category:

Documents


0 download

DESCRIPTION

PART V. Transport Layer. Position of transport layer. Transport layer duties. Packetizing: Dividing large messages and adding a header Connection control: Connection-oriented or connectionless delivery Addressing Providing reliability: Flow control and error control - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: PART V. Transport Layer

Fall 2005 Computer Networks 22-1

PART V.Transport Layer

Page 2: PART V. Transport Layer

Fall 2005 Computer Networks 22-2

Position of transport layer

Page 3: PART V. Transport Layer

Fall 2005 Computer Networks 22-3

Transport layer duties

• Packetizing: Dividing large messages and adding a header

• Connection control: Connection-oriented or connectionless delivery

• Addressing

• Providing reliability: Flow control and error control

• Congestion control and QoS

Page 4: PART V. Transport Layer

Fall 2005 Computer Networks 22-4

Chapter 22. Process-to-Process Delivery

UDP and TCP

22.1 Process-to-Process Delivery

22.2 UDP

22.3 TCP

Page 5: PART V. Transport Layer

Fall 2005 Computer Networks 22-5

Types of data deliveries

• The transport layer is responsible for process-to-process delivery.• Process (application program ??)

Page 6: PART V. Transport Layer

Fall 2005 Computer Networks 22-6

Client-Server Paradigm

• Address required for delivery

• Transport layer address: port number

Addressing

• Most common process-to-process communication is the client-server paradigm

• Operating systems support multiuser and multiprogramming environments.

• Local host, local process, remote host, remote process must be defined

Page 7: PART V. Transport Layer

Fall 2005 Computer Networks 22-7

Port numbers

• 16 bits between 0 and 65553: ephemeral port number• IANA (Internet Assigned Number Authority) range: well-known

ports, registered ports, dynamic ports

Page 8: PART V. Transport Layer

Fall 2005 Computer Networks 22-8

IP addresses versus port numbers

Page 9: PART V. Transport Layer

Fall 2005 Computer Networks 22-9

Socket address

• Process-to-process delivery needs two identifiers, IP address and the port number

• Socket address is the combination of an IP address and a port number

• A transport-layer protocol needs a pair of socket addresses; the client and server socket address

Page 10: PART V. Transport Layer

Fall 2005 Computer Networks 22-10

Multiplexing and demultiplexing

• Multiplexing required because of several processes with only one transport-layer protocol

Page 11: PART V. Transport Layer

Fall 2005 Computer Networks 22-11

Connection establishment

• In the case of connection-oriented service

Page 12: PART V. Transport Layer

Fall 2005 Computer Networks 22-12

Connection termination

• In the case of connection-oriented service

Page 13: PART V. Transport Layer

Fall 2005 Computer Networks 22-13

UDP• UDP is a connectionless, unreliable protocol that has no flow and error control. It uses

port numbers to multiplex data from the application layer.

• UDP is a convenient transport-layer protocol for applications that provide flow and error control. It is also used by multimedia applications.

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

Page 14: PART V. Transport Layer

Fall 2005 Computer Networks 22-14

Well-known ports used by UDPPort 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)

Page 15: PART V. Transport Layer

Fall 2005 Computer Networks 22-15

Error control

• Error control at the data link layer does not guarantee error control at the transport layer.

• UDP: connectionless and unreliable

• TCP: connection-oriented and reliable

Page 16: PART V. Transport Layer

Fall 2005 Computer Networks 22-16

TCP• Transmission Control Protocol• Stream connection-oriented and reliable transport protocol• It adds connection-oriented and reliability features to the services of IP• Like UDP, TCP uses port numbers as transport-layer addresses• Unlike UDP, TCP is a stream-oriented protocol

Page 17: PART V. Transport Layer

Fall 2005 Computer Networks 22-17

Well-known ports used by TCPPort 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

Page 18: PART V. Transport Layer

Fall 2005 Computer Networks 22-18

Sending and receiving buffers

• Buffering handles the disparity between the speed of the producing and consuming processes

• One example: to use a circular array of 1-byte locations

Page 19: PART V. Transport Layer

Fall 2005 Computer Networks 22-19

TCP segments

• IP layer needs to send data in packets not as a stream of byte

Page 20: PART V. Transport Layer

Fall 2005 Computer Networks 22-20

Sequence number

• The bytes of data being transferred in each connection are numbered by TCP. The numbering starts with a randomly generated number.

• The value of the sequence number field in a segment defines the number of the first data byte contained in that segment.

• 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

• Example: 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:

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)

Page 21: PART V. Transport Layer

Fall 2005 Computer Networks 22-21

TCP segment format

Page 22: PART V. Transport Layer

Fall 2005 Computer Networks 22-22

TCP 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.

Page 23: PART V. Transport Layer

Fall 2005 Computer Networks 22-23

Three-step connection establishment

Page 24: PART V. Transport Layer

Fall 2005 Computer Networks 22-24

Four-step connection termination

Page 25: PART V. Transport Layer

Fall 2005 Computer Networks 22-25

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.

Page 26: PART V. Transport Layer

Fall 2005 Computer Networks 22-26

State transition diagram

• TCP software is implemented as a finite state machine

Page 27: PART V. Transport Layer

Fall 2005 Computer Networks 22-27

Sliding windows protocol

• 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.

• 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.

• 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.

Page 28: PART V. Transport Layer

Fall 2005 Computer Networks 22-28

Sender buffer and receive window

Sender buffer

Receive window

Page 29: PART V. Transport Layer

Fall 2005 Computer Networks 22-29

Sender buffer and sender window

Sliding the sender window

Page 30: PART V. Transport Layer

Fall 2005 Computer Networks 22-30

Sliding the sender window

Page 31: PART V. Transport Layer

Fall 2005 Computer Networks 22-31

Expanding the sender window

Shrinking the sender window

Page 32: PART V. Transport Layer

Fall 2005 Computer Networks 22-32

Silly window syndrome• When either the sending application creates data slowly or the receiving application

consumes data slowly, or both in the sliding window operation• Syndrome created by the sender:

– Nagle’s algorithm: accumulate data in the output buffer (simplicity)

• Syndrome created by the receiver– Clark’s solution: announce a window size of zero– Delayed acknowledgement

Error control• TCP uses three tools: checksum, acknowledgement, and time-out

• TCP is no negative acknowledgement in TCP

• Lost or corrupted segment, out-of-order segment, lost ACK

Page 33: PART V. Transport Layer

Fall 2005 Computer Networks 22-33

Lost segment

Page 34: PART V. Transport Layer

Fall 2005 Computer Networks 22-34

Lost acknowledgment

Page 35: PART V. Transport Layer

Fall 2005 Computer Networks 22-35

TCP timers

• To perform its operation smoothly, TCP uses four timers• Retransmission timer

– Retransmission time = 2 X RTT (round-trip time)– RTT = ALPHA(previous RTT) + (1-ALPHA)(current RTT), usually 90%– Karn’s algorithm: when retransmission occurs, RTT ? no update RTT

• Persistence timer: To correct the deadlock, for instance, zero window-size announcement case with ACK loss. The sending TCP sends a special segment called a probe

Page 36: PART V. Transport Layer

Fall 2005 Computer Networks 22-36

Pushing Data and Urgent Data

• The application program on the sending site can request a push operation. This means that the sending TCP should not wait for the window to be filled and must create a segment and send it immediately

• The sending TCP can also set the push bit (PSH) to tell the receiving TCP that it must be delivered to the receiving application ASAP.

• The sending application wants a piece of data to be read out of order by the receiving application by sending urgent bytes

• If URG bit is set, the receiving TCP extracts the urgent data from the segment, using the value of the urgent pointer, and delivers it, out of order, to the receiving application