Download presentation
Presentation is loading. Please wait.
1
Transmission Control Protocol
Chapter 12 Transmission Control Protocol Objectives Upon completion you will be able to: 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
2
CONTENTS PROCESS-TO-PROCESS COMMUNICATION TCP SERVICES NUMBERING BYTES
FLOW CONTROL SILLY WINDOW SYNDROME ERROR CONTROL TCP TIMERS
3
CONTENTS (continued) CONGESTION CONTROL SEGMENT OPTIONS CHECKSUM
CONNECTION STATE TRANSITION DIAGRAM TCP OERATION TCP PACKAGE
4
TCP/IP 프로토콜에서 TCP의 위치
5
전송 계층(TCP)이 제공하는 기능 프로세스간 통신 개설(포트 번호 이용)
전송 단계에서 흐름 제어 메커니즘 제공(슬라이딩 윈도우 프로토콜 이용) 전송 단계에서 오류 제어 메커니즘 제공(응답 패킷, 시간-초과, 재전송 방식 이용) 연결 지향의 신뢰성 있는 프로토콜
6
TCP SERVICES We explain the services offered by TCP to the processes at the application layer. The topics discussed in this section include: Process-to-Process Communication Stream Delivery Service Full-Duplex Communication Connection-Oriented Service Reliable Service
7
TCP 서비스 TCP-대-IP
8
12.1 TCP 서비스 클라이언트/서버 통신에 필요한 사항 로컬 클라이언트 프로그램 원격 서버 프로그램 로컬 호스트
원격 호스트 포트번호 IP 주소
9
TCP 서비스 포트 번호
10
TCP 서비스 TCP에서 사용되는 잘 알려진 포트
11
Example 1 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. $ grep ftp /etc/services ftp-data 20/tcp ftp-control 21/tcp
12
12.1 TCP 서비스 소켓 주소 IP 주소와 포트 번호의 조합 종단간 연결 설정에 사용 클라이언트와 서버 소켓 주소 필요
IP 헤더(IP 주소)와 TCP 헤더(포트 번호)에 들어있음
13
TCP 서비스 스트림 배달 서비스 전이중 서비스 연결 지향 서비스 신뢰성 서비스
14
TCP 서비스 스트림 배달
15
12.1 TCP 서비스 스트림 배달 서비스 송신 TCP 수신 TCP
송신 응용 프로그램으로부터 문자 스트림 수신(송신 버퍼 이용) 적절한 크기인 세그먼트를 만들어 네트워크를 통하여 전송 수신 TCP 세그먼트를 수신(수신 버퍼 이용) 데이터를 추출하여 문자 스트림으로 수신 응용 프로그램에 전달
16
TCP 서비스 송신 버퍼와 수신 버퍼
17
TCP 서비스 TCP 세그먼트
18
12.1 TCP 서비스 전이중 서비스 연결-지향 서비스 신뢰성 서비스 동시에 양방향 전송
송신 데이터와 수신 데이터에 대한 확인 응답을 함께 보내는 피기백킹(piggybacking) 연결-지향 서비스 TCP는 연결지향 프로토콜 물리적 연결이 아닌 가상의 연결 요청→승인 → 데이터 교환 → 해제 순으로 진행 신뢰성 서비스 확인 응답 메커니즘 이용
19
TCP FEATURES To provide the services mentioned in the previous section, TCP has several features that are briefly summarized in this section. The topics discussed in this section include: Numbering System Flow Control Error Control Congestion Control
20
12.2 바이트 순서 Note: The bytes of data being transferred in each connection are numbered by TCP. The numbering starts with a randomly generated number.
21
Solution The following shows the sequence number for each segment:
Example 2 Suppose a TCP connection is transferring a file of 5000 bytes. The first byte is numbered What are the sequence numbers for each segment if data is sent in five segments, each carrying 1000 bytes? Solution The 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)
22
12.2 바이트 순서 Note: The value in the sequence number field of a segment defines the number of the first data byte contained in that segment.
23
The acknowledgment number is cumulative.
12.2 바이트 순서 확인응답번호 Note: The value of the acknowledgment field in a segment defines the number of the next byte a party expects to receive. The acknowledgment number is cumulative.
24
12.2 바이트 순서 흐름 제어 오류 제어 혼잡 제어 데이터 수신측은 송신측에서 전송할 데이터양 제어
신뢰성 있는 서비스를 제공하기 위해 오류 제어 메커니즘 구현 혼잡 제어 망의 혼잡을 고려하여 데이터양을 수신측에서 조절
25
12.3 SEGMENT A packet in TCP is called a segment
The topics discussed in this section include: Format Encapsulation
26
12.3 세그먼트 TCP 세그먼트 형태 TCP를 이용하여 두 개의 장치간에 전달되는 데이터 단위
27
12.3 세그먼트 세그먼트 발신지 포트 번호(source port address) : 전송 호스트 응용 프로그램의 포트 번호
목적지 포트 번호(destination port address) : 수신 호스트 응용 프로그램의 포트 번호 순서 번호(sequence number) : 세그먼트에 포함된 데이터의 첫번째 바이트에 부여된 번호 확인 응답 번호(acknowledgement number) : 상대방 노드로부터 수신하고자 하는 바이트의 번호 헤더길이(header length) : TCP 헤더 길이의 4바이트 워드 값 제어(control) : 제어 또는 플래그
28
12.3 세그먼트 제어 필드
29
12.3 세그먼트
30
12.3 세그먼트 세그먼트(계속) 윈도우 크기(window size) : 상대방이 유지해야 하는 바이트 단위의 윈도우 크기
검사합(checksum) : 오류 제어 긴급 포인터(urgent pointer) : 긴급 데이터 옵션(option) : 옵션 정보
31
12.3 세그먼트 Pseudoheader added to the TCP datagram
32
The inclusion of the checksum in TCP is mandatory.
12.3 세그먼트 Note: The inclusion of the checksum in TCP is mandatory.
33
12.3 세그먼트 Encapsulation and decapsulation
34
A TCP CONNECTION TCP is connection-oriented. A connection-oriented transport protocol 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 connection-oriented transmission requires three phases: connection establishment, data transfer, and connection termination. The topics discussed in this section include: Connection Establishment Data Transfer Connection Termination Connection Reset
35
12.4 연결 TCP : 연결-지향 프로토콜 발신지와 목적지 간에 가상 경로 설정 연결 설정과 연결 종료를 통하여 이루어짐
36
12.4 연결 연결 설정 4 단계 수행 호스트 A는 호스트 B에게 연결 설정 세그먼트를 전송(초기화 정보)
호스트 B는 호스트 A에게 확인응답 세그먼트 전송 호스트 B는 호스트 A에게 초기화 정보 세그먼트 전송 호스트 A는 호스트 B에게 확인응답 세그먼트 전송
37
12.4 연결 3 단계 핸드쉐이크(three-way handshaking)
38
A SYN segment cannot carry data, but it consumes one sequence number.
12.4 연결 Note: A SYN segment cannot carry data, but it consumes one sequence number.
39
12.4 연결 Note: A SYN + ACK segment cannot carry data, but does consume one sequence number.
40
An ACK segment, if carrying no data, consumes no sequence number.
12.4 연결 Note: An ACK segment, if carrying no data, consumes no sequence number.
41
12.4 연결 Data transfer
42
12.4 연결 Note: The FIN segment consumes one sequence number if it does not carry data.
43
12.4 연결 Connection termination using three-way handshaking
44
12.4 연결 The FIN + ACK segment consumes one sequence number if it does not carry data. Note:
45
12.4 연결 Half-close
46
12.5 STATE TRANSITION DIAGRAM
To keep track of all the different events happening during connection establishment, connection termination, and data transfer, the TCP software is implemented as a finite state machine. . The topics discussed in this section include: Scenarios
47
12.5 상태 천이 다이어그램 유한 상태 기기(finite state machine) 이용 구현 TCP 상태
48
12.5 상태 천이 다이어그램 상태 천이 다이어그램
49
12.5 상대 천이 다이어그램 상태 천이 다이어그램 상태(state) : 타원형 한 상태에서 다른 상태로의 천이 : 지시선
사선으로 나누어지는 두 개의 문자열 첫번째 열 : TCP가 수신하는 입력 두번째 열 : TCP가 전송하는 출력 점선 : 서버 실선 : 클라이언트 가는선 : 비 정상적인 상황
50
12.5 상태 천이 다이어그램 Common scenario
51
The common value for MSL is between 30 seconds and 1 minute.
12.5 상태 천이 다이어그램 Note: The common value for MSL is between 30 seconds and 1 minute.
52
12.5 상태 천이 다이어그램 Three-way handshake
53
12.5 상태 천이 다이어그램 Simultaneous open
54
12.5 상태 천이 다이어그램 Simultaneous close
55
12.5 상태 천이 다이어그램 Denying a connection
56
12.5 상태 천이 다이어그램 Aborting a connection
57
FLOW CONTROL Flow control regulates the amount of data a source can send before receiving an acknowledgment from the destination. TCP defines a window that is imposed on the buffer of data delivered from the application program. The topics discussed in this section include: Sliding Window Protocol Silly Window Syndrome
58
12.6 흐름 제어 Sliding window
59
TCP’s sliding windows are byte oriented.
12.6 흐름 제어 Note: A sliding window is used to make transmission more efficient as well as to control the flow of data so that the destination does not become overwhelmed with data. TCP’s sliding windows are byte oriented.
60
Example 3 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? Solution The 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.
61
Example 4 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? Solution The size of the window is the smaller of rwnd and cwnd, which is 3,000 bytes.
62
Example 5 Figure 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.
63
12.6 흐름 제어 Example 5
64
Example 6 In Figure 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. Solution Figure 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.
65
12.6 흐름 제어 Example 6
66
Example 7 In Figure 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. Solution The value of rwnd is less than cwnd, so the size of the window is 12. Figure 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.
67
12.6 흐름 제어 Example 7
68
Example 8 In Figure 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. Solution The value of rwnd is less than cwnd, so the size of the window is 5. Figure 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.
69
12.6 흐름 제어 Example 8
70
Example 9 How can the receiver avoid shrinking the window in the previous example? Solution The 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 rwnd or new rwnd ≥ (last ack + last rwnd) − new ack
71
12.6 흐름 제어 Note: To avoid shrinking the sender window, the receiver must wait until more space is available in its buffer.
72
12.6 흐름 제어 Note: 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.
73
ERROR CONTROL TCP provides reliability using error control, which detects corrupted, lost, out-of-order, and duplicated segments. Error control in TCP is achieved through the use of the checksum, acknowledgment, and time-out. The topics discussed in this section include: Checksum Acknowledgment Acknowledgment Type Retransmission Out-of-Order Segments Some Scenarios
74
ACK segments do not consume sequence numbers and are not acknowledged.
12.7 오류 제어 Note: ACK segments do not consume sequence numbers and are not acknowledged.
75
12.7 오류 제어 Note: In modern implementations, a retransmission occurs if the retransmission timer expires or three duplicate ACK segments have arrived.
76
No retransmission timer is set for an ACK segment.
12.7 오류 제어 Note: No retransmission timer is set for an ACK segment.
77
12.7 오류 제어 Note: 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.
78
12.7 오류 제어 오류 감지 메커니즘 훼손 세그먼트 손실 세그먼트 순서가 어긋난 세그먼트 중복 세그먼트 오류 정정 메커니즘
79
12.7 오류 제어 오류 발견과 정정 오류 발견 도구 : 검사합, 확인응답, 시간-초과
세그먼트의 검사합 필드 이용 훼손 여부 확인 수신을 송신측에 알려주는 확인응답 이용 시간-초과 전까지 확인응답 되지 않으면 훼손 또는 손실 간주 오류 정정 : 시간-초과 카운터 이용 - 재전송
80
12.7 오류 제어 훼손 세그먼트
81
12.7 오류 제어 손실 세그먼트
82
12.7 오류 제어 중복 세그먼트 순서가 잘못된 세그먼트 시간-초과 이전에 확인응답이 도착하지 않는 송신
같은 순서번호를 가진 세그먼트는 폐기 순서가 잘못된 세그먼트 데이터그램의 서로 다른 경로를 통한 전달로 인하여 발생 이전의 세그먼트로 모두 수신하기까지 확인응답을 전송하지 않음 시간-초과가 발생하면 세그먼트가 재전송 됨
83
The receiver TCP delivers only ordered data to the process.
12.7 오류 제어 Note: The receiver TCP delivers only ordered data to the process.
84
12.7 오류 제어 확인응답 손실
85
12.7 오류 제어 Lost acknowledgment
86
12.7 오류 제어 Lost acknowledgment corrected by resending a segment
87
12.7 오류 제어 Note: Lost acknowledgments may create deadlock if they are not properly handled.
88
CONGESTION CONTROL Congestion control refers to the mechanisms and techniques to keep the load below the capacity. The topics discussed in this section include: Network Performance Congestion Control Mechanisms Congestion Control in TCP
89
12.8 혼잡제어 Router queues
90
TCP는 손실 세그먼트의 원인이 망의 혼잡에 기인한 것이라고 가정한다.
12.8 혼잡제어 혼잡(Congestion) 현상 라우터가 패킷을 처리할 수 있는 속도보다 더 빨리 패킷을 수신하는 경우 발생 TCP는 손실 세그먼트의 원인이 망의 혼잡에 기인한 것이라고 가정한다.
91
12.8 혼잡제어 Packet delay and network load
92
12.8 혼잡제어 Throughput versus network load
93
12.8 혼잡제어 혼잡 윈도우 혼잡회피 실제 윈도우 크기 = 최소(수신측에서 알려주는 윈도우 크기, 혼잡 윈도우 크기)
느린 시작 : 임계치 설정(최대 윈도우 크기의 반), 임계치에 도달할 때까지 확인응답이 도착하면 지수형태로 윈도우 크기를 증가 가산증가 : 임계치까지 도달하면, 확인응답이 도착하면 혼잡 윈도우 크기를 하나씩 증가 지수 감소 : 혼잡이 발생하면 임계치를 현재 윈도우 크기의 반으로 줄여서 느린 시작을 수행
94
12.8 혼잡제어 Slow start, exponential increase
95
12.8 혼잡제어 Note: In the slow start algorithm, the size of the congestion window increases exponentially until it reaches a threshold.
96
12.8 혼잡제어 Congestion avoidance, additive increase
97
12.8 혼잡제어 Note: In the congestion avoidance algorithm the size of the congestion window increases additively until congestion is detected.
98
12.8 혼잡제어 Note: 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.
99
12.8 혼잡제어 TCP congestion policy summary
100
12.8 혼잡제어 Congestion example
101
TCP TIMERS To perform its operation smoothly, most TCP implementations use at least four timers. The topics discussed in this section include: Retransmission Timer Persistence Timer Keepalive Timer TIME-WAIT Timer
102
12.9 TCP 타이머 TCP 타이머
103
12.9 TCP 타이머 Note: In TCP, there can be only be one RTT measurement in progress at any time.
104
Example 10 Let us give a hypothetical example. Figure shows part of a connection. The figure shows the connection establishment and part of the data transfer phases. 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 = RTTS = 1.5 RTTD = 1.5 / 2 = RTO = = 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:
105
Example 10 RTTM = RTTS = 1.5 RTTD = 1.5 / 2 = RTO = = 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 = RTTS = 7/8 (1.5) + 1/8 (2.5) = RTTD = 3/4 (7.5) + 1/4 |1.625 − 2.5| = RTO = (0.78) = 4.74
106
12.9 TCP 타이머 Example 10
107
12.9 TCP 타이머 Note: TCP does not consider the RTT of a retransmitted segment in its calculation of a new RTO.
108
Example 11 Figure 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).
109
12.9 TCP 타이머 Example 11
110
12.9 TCP 타이머 재전송 타이머(retransmission timer)
재전송 시간 : 세그먼트 전송 후 확인응답을 기다리는 시간 타이머가 끝나기 전 확인응답이 수신되면 타이머 소멸 확인응답이 수신되기 전 타이머가 종료되면 해당 세그먼트는 재전송되고 타이머 초기화 재전송 시간 = 2 * RTT(round-trip time)
111
12.9 TCP 타이머 Karn 알고리즘 영속 타이머(persistence timer)
전송된 세그먼트에 대해 확인 응답되지 않아 재전송된 경우 이전 세그먼트에 대한 확인응답인지 재전송에 대한 확인응답인지 여부 판단이 애매하다 RTT 값은 재전송 없이 확인응답 수신 전까지 변동이 없음 영속 타이머(persistence timer) 윈도우 크기가 0 인 경우를 처리하기 위한 타이머 수신 TCP가 윈도우 크기 0 을 통보했는데, 송신 TCP가 이에 대한 확인응답을 보냈지만 수신 TCP가 이를 수신하지 못함 양쪽 TCP가 서로 기다리는 교착상태(deadlock) 해결
112
12.9 TCP 타이머 Keepalive 타이머 시간-대기 타이머(time-waited timer)
두 TCP 간에 설정된 연결이 오랫동안 휴지(idle) 상태에 있는 것을 방지하기 위한 타이머 시간-종료 : 2 시간 2 시간이 지나도록 세그먼트를 수신하지 못하면 75초 간격으로 10 개의 프루브(probe) 전송 응답이 없으면 다운으로 간주하고 연결 종료 시간-대기 타이머(time-waited timer) 연결 종료 동안에 사용
113
OPTIONS The TCP header can have up to 40 bytes of optional information. Options convey additional information to the destination or align other options.
114
12.10 옵션 옵션
115
12.10 옵션 옵션-끝(end of option) 맨 끝에 패딩을 위해 사용되는 한 바이트 옵션
116
EOP can be used only once.
12.10 옵션 Note: EOP can be used only once.
117
12.10 옵션 무 동작(no operation) 맨 끝에 패딩을 위해 사용되는 한 바이트 옵션
118
NOP can be used more than once.
12.10 옵션 Note: NOP can be used more than once.
119
12.10 옵션 최대 세그먼트 크기(maximum segment size : MSS)
목적지에서 수신할 수 있는 데이터 세그먼트의 최대 크기 연결 설정 단계 중에 목적지에 의해 결정
120
12.10 옵션 Note: The value of MSS is determined during connection establishment and does not change during the connection.
121
12.10 옵션 윈도우 확장 인자 윈도우 크기를 증가시키기 위해 사용 최대 설정값 : 16
새로운 윈도우 크기 = 헤더에서 정의된 윈도우 크기 Χ2 윈도우확장인자 최대 설정값 : 16 최대 윈도우 크기 : 216Χ216=232(순서번호 값과 동일)
122
12.10 옵션 Note: The value of the window scale factor can be determined only during connection establishment; it does not change during the connection.
123
12.10 옵션 타임 스탬프(timestamp) 10바이트 길이 옵션 왕복시간(round-trip time) 계산에 사용
124
12.10 옵션 Note: One application of the timestamp option is the calculation of round trip time (RTT).
125
Example 12 Figure 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. 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.
126
Example 12 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 to 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 (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 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 (next segment).
127
Example 12 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.
128
12.10 옵션 Example 12
129
The timestamp option can also be used for PAWS.
12.10 옵션 Note: The timestamp option can also be used for PAWS.
130
12.10 옵션 SACK
131
Example 13 Let us see how the SACK option is used to list out-of-order blocks. In Figure an end has received five segments of data. 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 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.
132
12.10 옵션 Example 13
133
Example 14 The example in Figure 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.
134
12.10 옵션 Example 14
135
Example 15 The example in Figure 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.
136
12.10 옵션 Example 15
137
TCP PACKAGE We present a simplified, bare-bones TCP package to simulate the heart of TCP. The package involves tables called transmission control blocks, a set of timers, and three software modules. The topics discussed in this section include: Transmission Control Blocks (TCBs) Timers Main Module Input Processing Module Output Processing Module
138
12.11 TCP 설계 전송 제어 블록(TCB : Transmission Control Block) 타이머(Timer)
메인 모듈(Main Module) 입력 프로세스 모듈(Input Process Module) 출력 프로세스 모듈(Output Process Module)
139
12.11 TCP 설계 TCP 설계
140
12.11 TCP 설계 전송 제어 블록(TCB) 연결 제어에 대한 정보 보관
141
12.11 TCP 설계 전송 제어 블록(TCB) 상태(state) 프로세스(process) 로컬 IP 주소 로컬 포트 번호
원격지 포트 번호 인터페이스 로컬 윈도우
142
12.11 TCP 설계 전송 제어 블록(TCB)(계속) 원격지 윈도우 송신순서번호 수신순서번호 왕복(round-trip)시간
시간 초과 값 버퍼 크기 버퍼 포인터
143
12.11 TCP 설계 타이머 메인 모듈 입력 처리 모듈 출력 처리 모듈 TCP 동작을 처리하기 위한 여러 가지 타이머
시간-초과 이벤트 발생 응용 프로그램으로부터 메시지가 들어오는 경우 입력 처리 모듈 연결 설정 상태에서 수신하는 데이터나 확인응답을 처리하기 위해 필요한 기능담당 출력 처리 모듈 연결 설정 상태에서 응용 프로그램으로부터 수신한 데이터를 전송하기 위해 필요한 기능 담당
144
알림 연습문제 풀이해서 Report로 다음주까지(일주일 후) 제출해 주세요!
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.