Top Banner
1 HANNAM UNIVERSITY Http://netwk.hannam.ac.kr Chapter 12 Chapter 12 Upon completion you will be able to: Transmission Transmission Control Protocol Control Protocol Be able to name and understand the services offered by TCP Understand TCP’s flow and error control and congestion control Be familiar with the fields in a TCP segment Understand the phases in a connection-oriented connection Understand the TCP transition state diagram Be able to name and understand the timers used in TCP Objectives
144

HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

Jan 20, 2016

Download

Documents

Osborn Rich
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

1HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Chapter 12Chapter 12

Upon completion you will be able to:

TransmissionTransmissionControl ProtocolControl Protocol

• Be able to name and understand the services offered by TCP• Understand TCP’s flow and error control and congestion control• Be familiar with the fields in a TCP segment• Understand the phases in a connection-oriented connection• Understand the TCP transition state diagram• Be able to name and understand the timers used in TCP• Be familiar with the TCP options

Objectives

Page 2: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

2HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

CONTENTSCONTENTS

• PROCESS-TO-PROCESS COMMUNICATION• TCP SERVICES• NUMBERING BYTES• FLOW CONTROL• SILLY WINDOW SYNDROME• ERROR CONTROL• TCP TIMERS

Page 3: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

3HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

CONTENTS CONTENTS (continued)(continued)

• CONGESTION CONTROL• SEGMENT• OPTIONS• CHECKSUM• CONNECTION• STATE TRANSITION DIAGRAM• TCP OERATION• TCP PACKAGE

Page 4: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

4HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

TCP/IP TCP/IP 프로토콜에서 프로토콜에서 TCPTCP 의 위치의 위치

Page 5: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

5HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

전송 계층전송 계층 ((TCP)TCP) 이 제공하는 기능이 제공하는 기능

프로세스간 통신 개설 ( 포트 번호 이용 )

전송 단계에서 흐름 제어 메커니즘 제공 (

슬라이딩 윈도우 프로토콜 이용 )

전송 단계에서 오류 제어 메커니즘 제공 ( 응답

패킷 , 시간 - 초과 , 재전송 방식 이용 )

연결 지향의 신뢰성 있는 프로토콜

Page 6: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

6HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.1 TCP SERVICES

We explain the services offered by TCP to the processes at the We explain the services offered by TCP to the processes at the application layer.application layer.

The topics discussed in this section include:The topics discussed in this section include:

Process-to-Process CommunicationProcess-to-Process CommunicationStream Delivery ServiceStream Delivery ServiceFull-Duplex CommunicationFull-Duplex CommunicationConnection-Oriented ServiceConnection-Oriented ServiceReliable ServiceReliable Service

Page 7: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

7HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

TCP- 대 -IP

12.1 TCP 서비스

Page 8: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

8HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

클라이언트 / 서버 통신에 필요한 사항

로컬 클라이언트 프로그램

원격 서버 프로그램

로컬 호스트

원격 호스트

포트번호

IP 주소

12.1 TCP 서비스

Page 9: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

9HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

포트 번호

12.1 TCP 서비스

Page 10: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

10HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

TCP 에서 사용되는 잘 알려진 포트

12.1 TCP 서비스

Page 11: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

11HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

As we said in Chapter 11, 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 ports for FTP.

Example 1

$ grep ftp /etc/services

ftp-data 20/tcpftp-control 21/tcp

Page 12: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

12HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

소켓 주소IP 주소와 포트 번호의 조합

종단간 연결 설정에 사용

클라이언트와 서버 소켓 주소 필요

IP 헤더 (IP 주소 ) 와 TCP 헤더 ( 포트 번호 ) 에

들어있음

12.1 TCP 서비스

Page 13: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

13HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

스트림 배달 서비스

전이중 서비스

연결 지향 서비스

신뢰성 서비스

12.1 TCP 서비스

Page 14: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

14HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

스트림 배달

12.1 TCP 서비스

Page 15: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

15HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

스트림 배달 서비스송신 TCP

송신 응용 프로그램으로부터 문자 스트림 수신 ( 송신 버퍼 이용 )

적절한 크기인 세그먼트를 만들어 네트워크를 통하여 전송

수신 TCP 세그먼트를 수신 ( 수신 버퍼 이용 ) 데이터를 추출하여 문자 스트림으로 수신 응용 프로그램에

전달

12.1 TCP 서비스

Page 16: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

16HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

송신 버퍼와 수신 버퍼

12.1 TCP 서비스

Page 17: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

17HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

TCP 세그먼트

12.1 TCP 서비스

Page 18: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

18HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

전이중 서비스동시에 양방향 전송송신 데이터와 수신 데이터에 대한 확인 응답을

함께 보내는 피기백킹 (piggybacking) 연결 - 지향 서비스

TCP 는 연결지향 프로토콜물리적 연결이 아닌 가상의 연결요청→승인 → 데이터 교환 → 해제 순으로 진행

신뢰성 서비스확인 응답 메커니즘 이용

12.1 TCP 서비스

Page 19: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

19HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.2 TCP FEATURES

To provide the services mentioned in the previous section, TCP has To provide the services mentioned in the previous section, TCP has several features that are briefly summarized in this section. several features that are briefly summarized in this section.

The topics discussed in this section include:The topics discussed in this section include:

Numbering System Numbering System Flow ControlFlow ControlError ControlError ControlCongestion ControlCongestion Control

Page 20: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

20HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.2 2 바이트 순서바이트 순서

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

generated number.

Note:Note:

Page 21: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

21HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Suppose a TCP connection is transferring a file of 5000 bytes. The first byte is numbered 10001. What are the sequence numbers for each segment if data is sent in five segments, each carrying 1000 bytes?

Example 2

SolutionThe following shows the sequence number for each segment:

Segment 1 ➡ Sequence Number: 10,001 (range: 10,001 to 11,000)

Segment 2 ➡ Sequence Number: 11,001 (range: 11,001 to 12,000)

Segment 3 ➡ Sequence Number: 12,001 (range: 12,001 to 13,000)

Segment 4 ➡ Sequence Number: 13,001 (range: 13,001 to 14,000)

Segment 5 ➡ Sequence Number: 14,001 (range: 14,001 to 15,000)

Page 22: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

22HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

The value in the sequence number field of a segment defines the number

of the first data byte containedin that segment.

Note:Note:

12.12.2 2 바이트 순서바이트 순서

Page 23: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

23HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.2 2 바이트 순서바이트 순서 확인응답번호

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.

Note:Note:

Page 24: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

24HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

흐름 제어데이터 수신측은 송신측에서 전송할 데이터양

제어 오류 제어

신뢰성 있는 서비스를 제공하기 위해 오류 제어 메커니즘 구현

혼잡 제어망의 혼잡을 고려하여 데이터양을 수신측에서

조절

12.12.2 2 바이트 순서바이트 순서

Page 25: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

25HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.3 SEGMENT

A packet in TCP is called a segmentA packet in TCP is called a segment

The topics discussed in this section include:The topics discussed in this section include:

FormatFormatEncapsulationEncapsulation

Page 26: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

26HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.3 3 세그먼트세그먼트

TCP 세그먼트 형태TCP 를 이용하여 두 개의 장치간에 전달되는 데이터

단위

Page 27: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

27HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.3 12.3 세그먼트세그먼트

세그먼트 발신지 포트 번호 (source port address) : 전송 호스트 응용

프로그램의 포트 번호 목적지 포트 번호 (destination port address) : 수신 호스트 응용

프로그램의 포트 번호 순서 번호 (sequence number) : 세그먼트에 포함된 데이터의

첫번째 바이트에 부여된 번호 확인 응답 번호 (acknowledgement number) : 상대방

노드로부터 수신하고자 하는 바이트의 번호 헤더길이 (header length) : TCP 헤더 길이의 4 바이트 워드 값 제어 (control) : 제어 또는 플래그

Page 28: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

28HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.3 3 세그먼트세그먼트

제어 필드

Page 29: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

29HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.3 3 세그먼트세그먼트

Page 30: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

30HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.3 3 세그먼트세그먼트

세그먼트 ( 계속 )윈도우 크기 (window size) : 상대방이 유지해야

하는 바이트 단위의 윈도우 크기

검사합 (checksum) : 오류 제어

긴급 포인터 (urgent pointer) : 긴급 데이터

옵션 (option) : 옵션 정보

Page 31: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

31HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Pseudoheader added to the TCP

datagram

12.12.3 3 세그먼트세그먼트

Page 32: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

32HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

The inclusion of the checksum in TCP is mandatory.

Note:Note:

12.12.3 3 세그먼트세그먼트

Page 33: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

33HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.3 3 세그먼트세그먼트

Encapsulation and decapsulation

Page 34: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

34HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.4 A TCP CONNECTION

TCP is connection-oriented. A connection-oriented transport protocol TCP is connection-oriented. A connection-oriented transport protocol establishes a virtual path between the source and destination. All of the establishes a virtual path between the source and destination. All of the segments belonging to a message are then sent over this virtual path. A segments belonging to a message are then sent over this virtual path. A connection-oriented transmission requires three phases: connection connection-oriented transmission requires three phases: connection establishment, data transfer, and connection termination.establishment, data transfer, and connection termination.

The topics discussed in this section include:The topics discussed in this section include:

Connection EstablishmentConnection EstablishmentData TransferData TransferConnection TerminationConnection TerminationConnection ResetConnection Reset

Page 35: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

35HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.4 4 연결연결

TCP : 연결 - 지향 프로토콜

발신지와 목적지 간에 가상 경로 설정

연결 설정과 연결 종료를 통하여 이루어짐

Page 36: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

36HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.4 4 연결연결

연결 설정4 단계 수행

1)호스트 A 는 호스트 B 에게 연결 설정 세그먼트를 전송( 초기화 정보 )

2)호스트 B 는 호스트 A 에게 확인응답 세그먼트 전송

3)호스트 B 는 호스트 A 에게 초기화 정보 세그먼트 전송

4)호스트 A 는 호스트 B 에게 확인응답 세그먼트 전송

Page 37: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

37HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.4 4 연결연결

3 단계 핸드쉐이크 (three-way handshaking)

Page 38: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

38HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

A SYN segment cannot carry data, but it consumes one sequence number.

Note:Note:

12.12.4 4 연결연결

Page 39: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

39HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

A SYN + ACK segment cannot carry data, but does consume one

sequence number.

Note:Note:

12.12.4 4 연결연결

Page 40: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

40HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

An ACK segment, if carrying no data, consumes no sequence number.

Note:Note:

12.12.4 4 연결연결

Page 41: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

41HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.4 4 연결연결 Data transfer

Page 42: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

42HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

The FIN segment consumes one sequence number if it does not carry

data.

Note:Note:

12.12.4 4 연결연결

Page 43: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

43HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.4 4 연결연결 Connection termination using three-way

handshaking

Page 44: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

44HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

The FIN + ACK segment consumes one sequence number if it does not

carry data.

Note:Note:

12.12.4 4 연결연결

Page 45: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

45HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.4 4 연결연결

Half-close

Page 46: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

46HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.5 STATE TRANSITION DIAGRAM

To keep track of all the different events happening during connection To keep track of all the different events happening during connection establishment, connection termination, and data transfer, the TCP establishment, connection termination, and data transfer, the TCP software is implemented as a finite state machine. . software is implemented as a finite state machine. .

The topics discussed in this section include:The topics discussed in this section include:

ScenariosScenarios

Page 47: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

47HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.5 5 상태 천이 다이어그램상태 천이 다이어그램

유한 상태 기기 (finite state machine) 이용 구현 TCP 상태

Page 48: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

48HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.5 5 상태 천이 다이어그램상태 천이 다이어그램

상태 천이 다이어그램

Page 49: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

49HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.5 5 상대 천이 다이어그램상대 천이 다이어그램

상태 천이 다이어그램상태 (state) : 타원형한 상태에서 다른 상태로의 천이 : 지시선사선으로 나누어지는 두 개의 문자열

1)첫번째 열 : TCP 가 수신하는 입력2)두번째 열 : TCP 가 전송하는 출력

점선 : 서버실선 : 클라이언트가는선 : 비 정상적인 상황

Page 50: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

50HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.5 5 상태 천이 다이어그램상태 천이 다이어그램 Common scenario

Page 51: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

51HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

The common value for MSL is between 30 seconds and 1 minute.

Note:Note:

12.12.5 5 상태 천이 다이어그램상태 천이 다이어그램

Page 52: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

52HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.5 5 상태 천이 다이어그램상태 천이 다이어그램 Three-way handshake

Page 53: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

53HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.5 5 상태 천이 다이어그램상태 천이 다이어그램 Simultaneous

open

Page 54: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

54HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.5 5 상태 천이 다이어그램상태 천이 다이어그램 Simultaneous

close

Page 55: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

55HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.5 5 상태 천이 다이어그램상태 천이 다이어그램 Denying a

connection

Page 56: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

56HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.5 5 상태 천이 다이어그램상태 천이 다이어그램 Aborting a

connection

Page 57: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

57HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.6 FLOW CONTROL

Flow control regulates the amount of data a source can send before Flow control regulates the amount of data a source can send before receiving an acknowledgment from the destination. TCP defines a receiving an acknowledgment from the destination. TCP defines a window that is imposed on the buffer of data delivered from the window that is imposed on the buffer of data delivered from the application program. application program.

The topics discussed in this section include:The topics discussed in this section include:

Sliding Window ProtocolSliding Window ProtocolSilly Window SyndromeSilly Window Syndrome

Page 58: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

58HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.6 6 흐름 제어흐름 제어 Sliding window

Page 59: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

59HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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.

Note:Note:

12.12.6 6 흐름 제어흐름 제어

Page 60: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

60HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

What is the value of the receiver window (rwnd) for host A if the receiver, host B, has a buffer size of 5,000 bytes and 1,000 bytes of received and unprocessed data?

Example 3

SolutionThe value of rwnd = 5,000 − 1,000 = 4,000. Host B can receive only 4,000 bytes of data before overflowing its buffer. Host B advertises this value in its next segment to A.

Page 61: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

61HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

What is the size of the window for host A if the value of rwnd is 3,000 bytes and the value of cwnd is 3,500 bytes?

Example 4

SolutionThe size of the window is the smaller of rwnd and cwnd, which is 3,000 bytes.

Page 62: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

62HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Figure 12.21 shows an unrealistic example of a sliding window. The sender has sent bytes up to 202. We assume that cwnd is 20 (in reality this value is thousands of bytes). The receiver has sent an acknowledgment number of 200 with an rwnd of 9 bytes (in reality this value is thousands of bytes). The size of the sender window is the minimum of rwnd and cwnd or 9 bytes. Bytes 200 to 202 are sent, but not acknowledged. Bytes 203 to 208 can be sent without worrying about acknowledgment. Bytes 209 and above cannot be sent.

Example 5

Page 63: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

63HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.6 6 흐름 제어흐름 제어 Example 5

Page 64: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

64HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

In Figure 12.21 the server receives a packet with an acknowledgment value of 202 and an rwnd of 9. The host has already sent bytes 203, 204, and 205. The value of cwnd is still 20. Show the new window.

Example 6

SolutionFigure 12.22 shows the new window. Note that this is a case in which the window closes from the left and opens from the right by an equal number of bytes; the size of the window has not been changed. The acknowledgment value, 202, declares that bytes 200 and 201 have been received and the sender needs not worry about them; the window can slide over them.

Page 65: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

65HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.6 6 흐름 제어흐름 제어 Example 6

Page 66: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

66HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

In Figure 12.22 the sender receives a packet with an acknowledgment value of 206 and an rwnd of 12. The host has not sent any new bytes. The value of cwnd is still 20. Show the new window.

Example 7

SolutionThe value of rwnd is less than cwnd, so the size of the window is 12. Figure 12.23 shows the new window. Note that the window has been opened from the right by 7 and closed from the left by 4; the size of the window has increased.

Page 67: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

67HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.6 6 흐름 제어흐름 제어

Example 7

Page 68: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

68HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

In Figure 12.23 the host receives a packet with an acknowledgment value of 210 and an rwnd of 5. The host has sent bytes 206, 207, 208, and 209. The value of cwnd is still 20. Show the new window.

Example 8

SolutionThe value of rwnd is less than cwnd, so the size of the window is 5. Figure 12.24 shows the situation. Note that this is a case not allowed by most implementations. Although the sender has not sent bytes 215 to 217, the receiver does not know this.

Page 69: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

69HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.6 6 흐름 제어흐름 제어 Example 8

Page 70: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

70HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

How can the receiver avoid shrinking the window in the previous example?

Example 9

SolutionThe receiver needs to keep track of the last acknowledgment number and the last rwnd. If we add the acknowledgment number to rwnd we get the byte number following the right wall. If we want to prevent the right wall from moving to the left (shrinking), we must always have the following relationship.

new ack + new rwnd ≥ last ack + last rwndor

new rwnd ≥ (last ack + last rwnd) − new ack

Page 71: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

71HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

To avoid shrinking the sender window, the receiver must wait until more space

is available in its buffer.

Note:Note:

12.12.6 6 흐름 제어흐름 제어

Page 72: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

72HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Some points about TCP’s sliding windows:

❏ The size of the window is the lesser of rwnd and cwnd. ❏ The source does not have to send a full window’s

worth of data.❏ The window can be opened or closed by the receiver, but should not be shrunk.❏ The destination can send an acknowledgment at any time as long as it does not result in a shrinking window.❏ The receiver can temporarily shut down the window; the sender, however, can always send a segment of one byte after the window is shut down.

Note:Note:

12.12.6 6 흐름 제어흐름 제어

Page 73: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

73HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.7 ERROR CONTROL

TCP provides reliability using error control, which detects corrupted, TCP provides reliability using error control, which detects corrupted, lost, out-of-order, and duplicated segments. Error control in TCP is lost, out-of-order, and duplicated segments. Error control in TCP is achieved through the use of the checksum, acknowledgment, and time-achieved through the use of the checksum, acknowledgment, and time-out. out.

The topics discussed in this section include:The topics discussed in this section include:

ChecksumChecksumAcknowledgmentAcknowledgmentAcknowledgment TypeAcknowledgment TypeRetransmissionRetransmissionOut-of-Order Segments Out-of-Order Segments Some ScenariosSome Scenarios

Page 74: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

74HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

ACK segments do not consume sequence numbers and are not

acknowledged.

Note:Note:

12.12.7 7 오류 제어오류 제어

Page 75: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

75HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

In modern implementations, a retransmission occurs if the

retransmission timer expires or three duplicate ACK segments have arrived.

Note:Note:

12.12.7 7 오류 제어오류 제어

Page 76: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

76HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

No retransmission timer is set for an ACK segment.

Note:Note:

12.12.7 7 오류 제어오류 제어

Page 77: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

77HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Data may arrive out of order and be temporarily stored by the receiving TCP, but TCP guarantees that no out-of-order

segment is delivered to the process.

Note:Note:

12.12.7 7 오류 제어오류 제어

Page 78: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

78HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.7 7 오류 제어오류 제어

오류 감지 메커니즘훼손 세그먼트손실 세그먼트순서가 어긋난 세그먼트중복 세그먼트

오류 정정 메커니즘

Page 79: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

79HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.7 7 오류 제어오류 제어

오류 발견과 정정오류 발견 도구 : 검사합 , 확인응답 , 시간 - 초과세그먼트의 검사합 필드 이용 훼손 여부 확인수신을 송신측에 알려주는 확인응답 이용시간 - 초과 전까지 확인응답 되지 않으면 훼손

또는 손실 간주오류 정정 : 시간 - 초과 카운터 이용 - 재전송

Page 80: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

80HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.7 7 오류 제어오류 제어

훼손 세그먼트

Page 81: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

81HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.7 7 오류 제어오류 제어

손실 세그먼트

Page 82: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

82HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.7 7 오류 제어오류 제어

중복 세그먼트시간 - 초과 이전에 확인응답이 도착하지 않는 송신같은 순서번호를 가진 세그먼트는 폐기

순서가 잘못된 세그먼트데이터그램의 서로 다른 경로를 통한 전달로

인하여 발생이전의 세그먼트로 모두 수신하기까지 확인응답을

전송하지 않음시간 - 초과가 발생하면 세그먼트가 재전송 됨

Page 83: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

83HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.7 7 오류 제어오류 제어

The receiver TCP delivers only ordered data to the process.

Note:Note:

Page 84: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

84HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.7 7 오류 제어오류 제어

확인응답 손실

Page 85: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

85HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.7 7 오류 제어오류 제어 Lost

acknowledgment

Page 86: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

86HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.7 7 오류 제어오류 제어 Lost acknowledgment corrected by resending a

segment

Page 87: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

87HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Lost acknowledgments may create deadlock if they are not properly

handled.

Note:Note:

12.12.7 7 오류 제어오류 제어

Page 88: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

88HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.8 CONGESTION CONTROL

Congestion control refers to the mechanisms and techniques to keep the Congestion control refers to the mechanisms and techniques to keep the load below the capacity. load below the capacity.

The topics discussed in this section include:The topics discussed in this section include:

Network PerformanceNetwork PerformanceCongestion Control MechanismsCongestion Control MechanismsCongestion Control in TCPCongestion Control in TCP

Page 89: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

89HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.8 8 혼잡제어혼잡제어

Router queues

Page 90: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

90HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.8 8 혼잡제어혼잡제어

혼잡 (Congestion) 현상라우터가 패킷을 처리할 수 있는 속도보다 더 빨리

패킷을 수신하는 경우 발생

TCPTCP 는 손실 세그먼트의 원인이 망의 는 손실 세그먼트의 원인이 망의 혼잡에 기인한 것이라고 가정한다혼잡에 기인한 것이라고 가정한다 ..

Page 91: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

91HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.8 8 혼잡제어혼잡제어 Packet delay and network load

Page 92: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

92HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.8 8 혼잡제어혼잡제어 Throughput versus network load

Page 93: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

93HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.8 8 혼잡제어혼잡제어

혼잡 윈도우 실제 윈도우 크기 = 최소 ( 수신측에서 알려주는 윈도우

크기 , 혼잡 윈도우 크기 )

혼잡회피 느린 시작 : 임계치 설정 ( 최대 윈도우 크기의 반 ),

임계치에 도달할 때까지 확인응답이 도착하면 지수형태로 윈도우 크기를 증가

가산증가 : 임계치까지 도달하면 , 확인응답이 도착하면 혼잡 윈도우 크기를 하나씩 증가

지수 감소 : 혼잡이 발생하면 임계치를 현재 윈도우 크기의 반으로 줄여서 느린 시작을 수행

Page 94: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

94HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.8 8 혼잡제어혼잡제어

Slow start, exponential increase

Page 95: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

95HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

In the slow start algorithm, the size of the congestion window increases exponentially until it reaches a

threshold.

Note:Note:

12.12.8 8 혼잡제어혼잡제어

Page 96: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

96HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.8 8 혼잡제어혼잡제어 Congestion avoidance, additive increase

Page 97: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

97HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

In the congestion avoidance algorithm the size of the congestion window

increases additively until congestion is detected.

Note:Note:

12.12.8 8 혼잡제어혼잡제어

Page 98: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

98HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Most implementations react differently to congestion detection:

❏ If detection is by time-out, a new slow start phase starts.

❏ If detection is by three ACKs, a new congestion avoidance phase starts.

Note:Note:

12.12.8 8 혼잡제어혼잡제어

Page 99: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

99HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.8 8 혼잡제어혼잡제어 TCP congestion policy summary

Page 100: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

100HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.8 8 혼잡제어혼잡제어 Congestion

example

Page 101: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

101HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.9 TCP TIMERS

To perform its operation smoothly, most TCP implementations use at To perform its operation smoothly, most TCP implementations use at least four timers. least four timers.

The topics discussed in this section include:The topics discussed in this section include:

Retransmission TimerRetransmission TimerPersistence TimerPersistence TimerKeepalive TimerKeepalive TimerTIME-WAIT TimerTIME-WAIT Timer

Page 102: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

102HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.9 TCP 9 TCP 타이머타이머

TCP 타이머

Page 103: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

103HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

In TCP, there can be only be one RTT measurement in progress at any time.

Note:Note:

12.12.9 TCP 9 TCP 타이머타이머

Page 104: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

104HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Let us give a hypothetical example. Figure 12.38 shows part of a connection. The figure shows the connection establishment and part of the data transfer phases.

Example 10

1. When the SYN segment is sent, there is no value for RTTM , RTTS , or RTTD . The value of RTO is set to 6.00 seconds. The following shows the value of these variables at this moment:

RTTM = 1.5 RTTS = 1.5

RTTD = 1.5 / 2 = 0.75 RTO = 1.5 + 4 . 0.75 = 4.5

2. When the SYN+ACK segment arrives, RTTM is measured and is equal to 1.5 seconds. The next slide shows the values of these variables:

Page 105: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

105HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Example 10

RTTM = 1.5 RTTS = 1.5RTTD = 1.5 / 2 = 0.75 RTO = 1.5 + 4 . 0.75 = 4.5

3.When the first data segment is sent, a new RTT measurement starts. Note that the sender does not start an RTT measurement when it sends the ACK segment, because it does not consume a sequence number and there is no time-out. No RTT measurement starts for the second data segment because a measurement is already in progress.

RTTM = 2.5RTTS = 7/8 (1.5) + 1/8 (2.5) = 1.625RTTD = 3/4 (7.5) + 1/4 |1.625 − 2.5| = 0.78RTO = 1.625 + 4 (0.78) = 4.74

Page 106: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

106HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.9 TCP 9 TCP 타이머타이머 Example 10

Page 107: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

107HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

TCP does not consider the RTT of a retransmitted segment in its calculation of a new RTO.

Note:Note:

12.12.9 TCP 9 TCP 타이머타이머

Page 108: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

108HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Figure 12.39 is a continuation of the previous example. There is retransmission and Karn’s algorithm is applied. The first segment in the figure is sent, but lost. The RTO timer expires after 4.74 seconds. The segment is retransmitted and the timer is set to 9.48, twice the previous value of RTO. This time an ACK is received before the time-out. We wait until we send a new segment and receive the ACK for it before recalculating the RTO (Karn’s algorithm).

Example 11

Page 109: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

109HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.9 TCP 9 TCP 타이머타이머 Example 11

Page 110: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

110HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.9 TCP 9 TCP 타이머타이머

재전송 타이머 (retransmission timer)재전송 시간 : 세그먼트 전송 후 확인응답을

기다리는 시간

타이머가 끝나기 전 확인응답이 수신되면 타이머 소멸

확인응답이 수신되기 전 타이머가 종료되면 해당 세그먼트는 재전송되고 타이머 초기화

재전송 시간 = 2 * RTT(round-trip time)

Page 111: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

111HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.9 TCP 9 TCP 타이머타이머

Karn 알고리즘 전송된 세그먼트에 대해 확인 응답되지 않아 재전송된 경우 이전 세그먼트에 대한 확인응답인지 재전송에 대한

확인응답인지 여부 판단이 애매하다 RTT 값은 재전송 없이 확인응답 수신 전까지 변동이 없음

영속 타이머 (persistence timer) 윈도우 크기가 0 인 경우를 처리하기 위한 타이머 수신 TCP 가 윈도우 크기 0 을 통보했는데 , 송신 TCP 가

이에 대한 확인응답을 보냈지만 수신 TCP 가 이를 수신하지 못함

양쪽 TCP 가 서로 기다리는 교착상태 (deadlock) 해결

Page 112: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

112HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.9 TCP 9 TCP 타이머타이머

Keepalive 타이머두 TCP 간에 설정된 연결이 오랫동안 휴지 (idle)

상태에 있는 것을 방지하기 위한 타이머시간 - 종료 : 2 시간2 시간이 지나도록 세그먼트를 수신하지 못하면 7

5 초 간격으로 10 개의 프루브 (probe) 전송응답이 없으면 다운으로 간주하고 연결 종료

시간 - 대기 타이머 (time-waited timer)연결 종료 동안에 사용

Page 113: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

113HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.10 OPTIONS

The TCP header can have up to 40 bytes of optional information. The TCP header can have up to 40 bytes of optional information. Options convey additional information to the destination or align other Options convey additional information to the destination or align other options.options.

Page 114: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

114HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.10 10 옵션옵션

옵션

Page 115: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

115HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.10 10 옵션옵션

옵션 - 끝 (end of option)맨 끝에 패딩을 위해 사용되는 한 바이트 옵션

Page 116: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

116HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

EOP can be used only once.

Note:Note:

12.12.10 10 옵션옵션

Page 117: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

117HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.10 10 옵션옵션

무 동작 (no operation)맨 끝에 패딩을 위해 사용되는 한 바이트 옵션

Page 118: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

118HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

NOP can be used more than once.

Note:Note:

12.12.10 10 옵션옵션

Page 119: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

119HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.10 10 옵션옵션

최대 세그먼트 크기 (maximum segment size : MSS) 목적지에서 수신할 수 있는 데이터 세그먼트의 최대 크기 연결 설정 단계 중에 목적지에 의해 결정

Page 120: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

120HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

The value of MSS is determined during connection establishment and

does not change during the connection.

Note:Note:

12.12.10 10 옵션옵션

Page 121: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

121HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.10 10 옵션옵션

윈도우 확장 인자 윈도우 크기를 증가시키기 위해 사용 새로운 윈도우 크기 = 헤더에서 정의된 윈도우 크기 Χ2 윈도우확장인자

최대 설정값 : 16 최대 윈도우 크기 : 216Χ216=232( 순서번호 값과 동일 )

Page 122: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

122HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

The value of the window scale factor can be determined only during

connection establishment; it does not change during the connection.

Note:Note:

12.12.10 10 옵션옵션

Page 123: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

123HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.10 10 옵션옵션

타임 스탬프 (timestamp) 10 바이트 길이 옵션왕복시간 (round-trip time) 계산에 사용

Page 124: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

124HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

One application of the timestamp option is the calculation of round trip

time (RTT).

Note:Note:

12.12.10 10 옵션옵션

Page 125: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

125HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Figure 12.46 shows an example that calculates the round-trip time for one end. Everything must be flipped if we want to calculate the RTT for the other end.

Example 12

The sender simply inserts the value of the clock (for example, the number of seconds past from midnight) in the timestamp field for the first and second segment. When an acknowledgment comes (the third segment), the value of the clock is checked and the value of the echo reply field is subtracted from the current time. RTT is 12 s in this scenario.

Page 126: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

126HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

The receiver’s function is more involved. It keeps track of the last acknowledgment sent (12000). When the first segment arrives, it contains the bytes 12000 to 12099. The first byte is the same as the value of lastack. It then copies the timestamp value (4720) into the tsrecent variable. The value of lastack is still 12000 (no new acknowledgment has been sent). When the second segment arrives, since none of the byte numbers in this segment include the value of lastack, the value of the timestamp field is ignored. When the receiver decides to send an accumulative acknowledgment with acknowledgment 12200, it changes the value of lastack to 12200 and inserts the value of tsrecent in the echo reply field. The value of tsrecent will not change until it isreplaced by a new segment that carries byte 12200 (next segment).

Example 12

Page 127: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

127HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Note that as the example shows, the RTT calculated is the time difference between sending the first segment and receiving the third segment. This is actually the meaning of RTT: the time difference between a packet sent and the acknowledgment received. The third segment carries the acknowledgment for the first and second segments.

Example 12

Page 128: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

128HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.10 10 옵션옵션 Example 12

Page 129: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

129HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

The timestamp option can also be used for PAWS.

Note:Note:

12.12.10 10 옵션옵션

Page 130: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

130HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.10 10 옵션옵션 SACK

Page 131: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

131HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Let us see how the SACK option is used to list out-of-order blocks. In Figure 12.48 an end has received five segments of data.

Example 13

The first and second segments are in consecutive order. An accumulative acknowledgment can be sent to report the reception of these two segments. Segments 3, 4, and 5, however, are out of order with a gap between the second and third and a gap between the fourth and the fifth. An ACK and a SACK together can easily clear the situation for the sender. The value of ACK is2001, which means that the sender need not worry about bytes 1 to 2000. The SACK has two blocks. The first block announces that bytes 4001 to 6000 have arrived out of order. The second block shows that bytes 8001 to 9000 have also arrived out of order. This means that bytes 2001 to 4000 and bytes 6001 to 8000 are lost or discarded. The sender can resend only these bytes.

Page 132: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

132HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.10 10 옵션옵션 Example 13

Page 133: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

133HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

The example in Figure 12.49 shows how a duplicate segment can be detected with a combination of ACK and SACK. In this case, we have some out-of-order segments (in one block) and one duplicate segment. To show both out-of-order and duplicate data, SACK uses the first block, in this case, to show the duplicate data and other blocks to show out-of-order data. Note that only the first block can be used for duplicate data. The natural question is how the sender, when it receives these ACK and SACK values knows that the first block is for duplicate data (compare this example with the previous example). The answer is that the bytes in the first block are already acknowledged in the ACK field; therefore, this block must be a duplicate.

Example 14

Page 134: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

134HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.10 10 옵션옵션 Example 14

Page 135: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

135HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

The example in Figure 12.50 shows what happens if one of the segments in the out-of-order section is also duplicated. In this example, one of the segments (4001:5000) is duplicated. The SACK option announces this duplicate data first and then the out-of-order block. This time, however, the duplicated block is not yet acknowledged by ACK, but because it is part of the out-of-order block (4001:5000 is part of 4001:6000), it is understood by the sender that it defines the duplicate data.

Example 15

Page 136: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

136HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.10 10 옵션옵션 Example 15

Page 137: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

137HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.11 TCP PACKAGE

We present a simplified, bare-bones TCP package to simulate the heart We present a simplified, bare-bones TCP package to simulate the heart of TCP. The package involves tables called transmission control blocks, of TCP. The package involves tables called transmission control blocks, a set of timers, and three software modules.a set of timers, and three software modules.

The topics discussed in this section include:The topics discussed in this section include:

Transmission Control Blocks (TCBs)Transmission Control Blocks (TCBs)TimersTimersMain ModuleMain ModuleInput Processing ModuleInput Processing ModuleOutput Processing ModuleOutput Processing Module

Page 138: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

138HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.112.11 TCP 1 TCP 설계설계

전송 제어 블록 (TCB : Transmission Control Block)

타이머 (Timer)

메인 모듈 (Main Module)

입력 프로세스 모듈 (Input Process Module)

출력 프로세스 모듈 (Output Process Module)

Page 139: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

139HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.11 TCP 11 TCP 설계설계

TCP 설계

Page 140: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

140HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.12.11 TCP 11 TCP 설계설계

전송 제어 블록 (TCB) 연결 제어에 대한 정보 보관

Page 141: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

141HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.112.11 TCP 1 TCP 설계설계

전송 제어 블록 (TCB)상태 (state)

프로세스 (process)

로컬 IP 주소로컬 포트 번호원격지 IP 주소원격지 포트 번호인터페이스로컬 윈도우

Page 142: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

142HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.112.11 TCP 1 TCP 설계설계

전송 제어 블록 (TCB)( 계속 )원격지 윈도우송신순서번호수신순서번호왕복 (round-trip) 시간시간 초과 값버퍼 크기버퍼 포인터

Page 143: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

143HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

12.112.11 TCP 1 TCP 설계설계

타이머 TCP 동작을 처리하기 위한 여러 가지 타이머

메인 모듈 TCP 세그먼트 도착 시간 - 초과 이벤트 발생 응용 프로그램으로부터 메시지가 들어오는 경우

입력 처리 모듈 연결 설정 상태에서 수신하는 데이터나 확인응답을 처리하기

위해 필요한 기능담당 출력 처리 모듈

연결 설정 상태에서 응용 프로그램으로부터 수신한 데이터를 전송하기 위해 필요한 기능 담당

Page 144: HANNAM UNIVERSITY Http://netwk.hannam.ac.kr 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand.

144HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

연습문제 풀이해서

Report 로 다음주까지 (일주일 후 )

제출해 주세요 !

알림알림