(해석 또는 이해가 잘못된 부분이 있다면 댓글로 편하게 알려주세요.)
TCP sends its data in little chunks called IP packets (or IP datagrams). In this way, HTTP is the top layer in a “protocol stack” of “HTTP over TCP over IP,” as depicted in Figure 4-3a. A secure variant, HTTPS, inserts a cryptographic encryption layer (called TLS or SSL) between HTTP and TCP (Figure 4-3b).
TCP는 자신의 데이터를 IP 패킷 혹은 IP 데이터그램이라고 불리는 작은 덩어리의 형태로 전송합니다.
HTTP는 Figure 4-3a에 묘사된 것처럼 "HTTP over TCP over IP"의 프로토콜 스택에서 최상위 레이어입니다.
보안 변형인 HTTPS는 TLS 혹은 SSL이라 불리는 암호화 레이어를 HTTP와 TCP 사이에 삽입합니다. (Figure 4-3b)
When HTTP wants to transmit a message, it streams the contents of the message data, in order, through an open TCP connection. TCP takes the stream of data, chops up the data stream into chunks called segments, and transports the segments across the Internet inside envelopes called IP packets (see Figure 4-4). This is all handled by the TCP/IP software; the HTTP programmer sees none of it.
HTTP가 메시지를 전송하고자 할 때, 개방형 TCP 연결에 메시지 데이터의 내용을 순서대로 흘려 보냅니다.
TCP는 데이터의 스트림을 세그먼트라고 불리는 덩어리로 분해합니다. 그리고 인터넷을 통해 분해된 세그먼트를 IP 패킷이라고 불리는 봉투 안에 넣어 전송합니다. (Figure 4-4)
이것은 전부 TCP/IP 소프트웨어에 의해 처리되며, HTTP 프로그래머는 이 소프트웨어를 전혀 보지 못합니다.
Each TCP segment is carried by an IP packet from one IP address to another IP address. Each of these IP packets contains:
• An IP packet header (usually 20 bytes)
• A TCP segment header (usually 20 bytes)
• A chunk of TCP data (0 or more bytes)
TCP 세그먼트들은 IP 패킷에 의해 한 IP 주소에서 다른 IP 주소로 운반됩니다.
이때 각각의 IP 패킷은 다음과 같은 것들을 포함합니다.
- IP 패킷 헤더 (일반적으로 20바이트)
- TCP 세그먼트 헤더 (일반적으로 20바이트)
- TCP 데이터 덩어리 (0 이상의 바이트)
The IP header contains the source and destination IP addresses, the size, and other flags. The TCP segment header contains TCP port numbers, TCP control flags, and numeric values used for data ordering and integrity checking.
IP 헤더는 Source와 Destination의 IP 주소와 크기, 그 밖의 다른 flag들을 포함하고 있습니다.
또한 TCP 세그먼트 헤더에는 TCP 포트 번호와 TCP 컨트롤 플래그, 데이터 순서와 무결성 검사에 사용되는 숫자 값들이 포함되어 있습니다.
A computer might have several TCP connections open at any one time. TCP keeps all these connections straight through port numbers.
컴퓨터는 한 번에 여러 개의 TCP 연결을 열 수도 있습니다.
TCP는 이러한 모든 연결들을 포트 번호를 통해 곧게 유지합니다.
Port numbers are like employees’ phone extensions. Just as a company’s main phone number gets you to the front desk and the extension gets you to the right employee, the IP address gets you to the right computer and the port number gets you to the right application. A TCP connection is distinguished by four values:
<source-IP-address, source-port, destination-IP-address, destination-port>
포트 번호는 회사 직원들의 내선 번호와 같습니다.
회사의 주된 전화번호가 프론트 데스크로 연결되고 내선 번호를 통해 올바른 직원에게 전달되는 것처럼, IP 주소는 여러분이 올바른 컴퓨터와 포트 번호를 통해 올바른 애플리케이션에 연결되게 합니다.
TCP 연결은 다음의 네 가지 값으로 구분됩니다.
<source-IP-address, source-port, destination-IP-address, destination-port>
Together, these four values uniquely define a connection. Two different TCP connections are not allowed to have the same values for all four address components (but different connections can have the same values for some of the components).
더불어 이 네 가지 값은 단 하나의 연결을 정의합니다.
서로 다른 두 개의 TCP 연결이 IP 주소의 네 가지 컴포넌트에 대해 모두 동일한 값을 가질 수는 없습니다(물론 서로 다른 연결이 몇몇 컴포넌트에 대해서는 동일한 값을 가질 수 있습니다).
In Figure 4-5, there are four connections: A, B, C and D. The relevant information for each port is listed in Table 4-1.
Figure 4-5에는 A, B, C, D 총 4개의 연결이 있습니다.
각각의 포트에 대한 정보는 Table 4-1에 나열되어 있습니다.
Note that some of the connections share the same destination port number (C and D both have destination port 80). Some of the connections have the same source IP address (B and C). Some have the same destination IP address (A and B, and C and D). But no two different connections share all four identical values.
일부 연결은 동일한 Destination 포트 번호를 공유하고 있음에 유의합니다(C와 D는 동일한 Destination 포트인 80에 연결).
또다른 연결은 동일한 Source IP 주소를 가집니다(B와 C).
일부는 동일한 Destination IP 주소를 가지고 있습니다(A와 B, C와 D).
그러나 어떠한 연결도 4가지 값을 전부 동일하게 공유하지는 않습니다.
이번 요약 정리는 책의 외적인 내용도 포함합니다. 책에 설명되어 있는 내용만으로는 TCP를 1%도 이해하지 못할 것 같아서, 저도 한 번 더 복기하는 겸 개인적인 배경지식을 조금 더 덧붙였습니다...!
Window Size : TCP의 흐름 제어에 활용
Sequence Number : 전송중인 스트림의 첫 번째 바이트 혹은 Random Initialization 값
Acknowledgement Number : 다음에 전송 받아야 하는 스트림의 첫 번째 바이트
Control Field : ACK, RST(연결 초기화), SYN(연결 설정), FIN(연결 해제) 등
Frame : 데이터를 작은 조각으로 나누어 전달하는 방식
-> 데이터의 순서 보장 X, 추가 정렬 작업 필요
Stream : 데이터를 바이트 단위로 연속적으로 전달하는 방식
-> 몇 번째 Segment인지와는 관계없이 바이트 단위로 계산
-> 데이터의 순서 보장
<source-IP-address, source-port, destination-IP-address, destination-port>
한 컴퓨터가 여러 개의 TCP 연결을 하더라도 모든 TCP 연결은 네 가지 컴포넌트에 대해 모두 동일한 값을 가질 수 없다
단 TCP 연결이 동일한 Destination 포트 번호를 공유하는 경우도 있고, 동일한 IP 주소를 공유하는 경우도 있다
Chapter 4에서 조금 부족하게 설명되어 있는 부분은 예전에 공부했던 내용을 복습하며 더 깊게 공부하고 있다. HTTP라는 대주제 아래 쓰인 책이다 보니 TCP에 대해서는 가능한 한 핵심만 설명하는 것 같다(TCP를 전부 이해하려면 HTTP처럼 책 한 권을 써도 모자라니까...). 그래서 텍스트만으로 온전히 이해하기 어려운 구석이 있다. 예를 들어 책에서는 계속 Stream이라는 용어를 사용하는데 막상 Stream이 무엇인지에 대해서는 설명을 하고 있지 않고, TCP에서 전송 순서가 뒤바뀌지 않는 이유에 대해서도 명쾌하게 답을 주지 않는다. 물론 아직 앞부분이라 그런 걸수도 있다. 그렇지만 당장의 이해를 위해 필요한 정보들이 있으니 최대한 쉽게 풀어서 적었다.
사실 지금 시각이 새벽 4시쯤이다. 왠지 마음이 좀 어수선한 상태여서 잡생각을 버리려고 글을 쓰기 시작했다. 마음을 비우기 위한 공부는 다른 사람들 눈에 조금 이상하게 보일까...ㅎㅎㅎ 하지만 이런 날일수록 아무 생각없이 늘 습관처럼 해오던 일을 하는 게 오히려 마음이 정돈되는 기분이다.