(해석 또는 이해가 잘못된 부분이 있다면 댓글로 편하게 알려주세요.)
Operating systems provide different facilities for manipulating their TCP connections. Let’s take a quick look at one TCP programming interface, to make things concrete. Table 4-2 shows some of the primary interfaces provided by the sockets API. This sockets API hides all the details of TCP and IP from the HTTP programmer. The sockets API was first developed for the Unix operating system, but variants are now available for almost every operating system and language.
운영체제는 TCP 연결을 조작하기 위한 다양한 기능들을 제공합니다.
구체적으로 한 가지 TCP 프로그래밍 인터페이스를 살펴봅시다.
Table 4-2는 소켓 API가 제공하는 몇 가지 주요한 인터페이스를 보여줍니다.
해당 소켓 API는 HTTP 프로그래머로부터 TCP와 IP에 관한 세부 정보들을 전부 은닉합니다.
처음에 이것은 Unix 운영체제를 위해 만들어졌지만 현재는 해당 API의 변종들이 대부분의 운영체제와 언어에 대해 사용 가능합니다.
The sockets API lets you create TCP endpoint data structures, connect these endpoints to remote server TCP endpoints, and read and write data streams. The TCP API hides all the details of the underlying network protocol handshaking and the segmentation and reassembly of the TCP data stream to and from IP packets.
소켓 API는 TCP 엔드포인트 데이터 구조를 생성하고, 이러한 엔드포인트들을 원격 서버의 TCP 엔드포인트에 연결하며, 데이터 스트림을 읽고 쓰는 작업을 합니다.
TCP API는 내재하는 네트워크 프로토콜의 핸드쉐이킹, 그리고 IP 패킷을 통해 주고받는 TCP 데이터 스트림의 세그먼트화와 재배치에 대한 모든 세부 정보를 은닉합니다.
In Figure 4-1, we showed how a web browser could download the power-tools.html web page from Joe’s Hardware store using HTTP. The pseudocode in Figure 4-6 sketches how we might use the sockets API to highlight the steps the client and server could perform to implement this HTTP transaction.
Figure 4-1은 웹 브라우저가 HTTP를 사용하여 Joe's Hardware 상점으로부터 power-tools.html 웹페이지를 다운로드 하는 방법을 보여줍니다.
Figure 4-6의 의사코드는 소켓 API를 사용하는 방법을 나타내며, 클라이언트와 서버가 위와 같은 HTTP 트랜잭션을 수행하는 과정을 조명하고 있습니다.
We begin with the web server waiting for a connection (Figure 4-6, S4). The client determines the IP address and port number from the URL and proceeds to establish a TCP connection to the server (Figure 4-6, C3). Establishing a connection can take a while, depending on how far away the server is, the load on the server, and the congestion of the Internet.
이 트랜잭션은 서버가 연결을 기다리는 것부터 시작됩니다. (Figure 4-6, S4)
클라이언트는 URL로부터 IP 주소와 포트 번호를 결정하고 서버에 대한 TCP 연결 설정을 진행합니다. (Figure 4-6, C3)
연결을 설정하는 데는 서버가 얼마나 멀리 위치해있고 서버의 부하는 어느 정도인지, 인터넷의 혼잡도는 어떠한지에 따라 약간의 시간이 더 소요될 수 있습니다.
Once the connection is set up, the client sends the HTTP request (Figure 4-6, C5) and the server reads it (Figure 4-6, S6). Once the server gets the entire request message, it processes the request, performs the requested action (Figure 4-6, S7), and writes the data back to the client. The client reads it (Figure 4-6, C6) and processes the response data (Figure 4-6, C7).
연결이 설정되고 나면 클라이언트는 HTTP 요청을 전송하고(Figure 4-6, C5), 서버는 해당 요청을 확인합니다. (Figure 4-6, S6)
전반적인 요청 메시지를 받아들인 서버는 요청을 처리하며 요구받은 액션을 수행합니다(Figure 4-6, S7). 그리고 데이터를 클라이언트에게 다시 돌려줍니다.
클라이언트는 데이터를 읽고 (Figure 4-6, C6) 응답 데이터를 처리합니다. (Figure 4-6, C7)
뒤에 몇 줄만 제외하고 틈틈이 글을 써두긴 했는데... 술을 마시고 이어서 쓰려니 여간 힘든 일이 아니다. 그래도 소켓 프로그래밍에 관한 부분은 네트워크 수업에서 잠깐 다루었어서 내용을 이해하는 것이 크게 어렵지는 않았다.
저자가 TCP에 대한 내용을 줄이려고 노력한 것은 잘 알겠지만, TCP가 그런다고 줄여질 내용이 아니다. 아무리 글을 읽어도 이해가 잘 되지 않는다면 다양한 자료들을 함께 찾아보는 것이 좋겠다.