CS:APP 원서를 기반으로 작성한 내용
Aside) What Does Network Adapter Mean?
TCP(Transmission Control Protocol)
Port
(sockets programming)
Set of system-level functions (interface) used in conjunction with Unix I/O to build network applications.
struct sockaddr
(x:y, ip:port)
(that of the client)getaddrinfo
function for filling arguments such as socket length(sockelen_t addrlen)getaddrinfo
)In Unix and Unix-like computer operating systems, a file descriptor (FD, less frequently fildes) is a process-unique identifier (handle) for a file or other input/output resource, such as a pipe or network socket.
File descriptors typically have non-negative integer values, with negative values being reserved to indicate "no value" or error conditions.
File descriptors are a part of the POSIX API. Each Unix process (except perhaps daemons) should have three standard POSIX file descriptors, corresponding to the three standard streams:
Integer value / Name / <unistd.h> symbolic constant / <stdio.h> file stream
출처 : File descriptor - Wikipedia
파일 디스크립터(File Descriptor)란 리눅스 혹은 유닉스 계열의 시스템에서 프로세스(process)가 파일(file)을 다룰 때 사용하는 개념으로, 프로세스에서 특정 파일에 접근할 때 사용하는 추상적인 값이다. 파일 디스크럽터는 일반적으로 0이 아닌 정수값을 갖는다. (위의 영문 글의 내용에 따라서 음수가 아닌 정수값을 갖는다는게 더 정확한 표현이 아닐까 생각한다.)
흔히 유닉스 시스템에서 모든 것을 파일이라고 한다. 일반적인 정규파일부터 디렉토리, 소켓, 파이프, 블록 디바이스, 케릭터 디바이스 등 모든 객체들을 파일로 관리한다. 유닉스 시스템에서 프로세스가 이 파일들을 접근할 때 파일 디스크립터라는 개념일 이용한다. 프로세스가 실행 중에 파일을 Open하면 커널은 해당 프로세스의 파일 디스크립터 숫자 중 사용하지 않는 가장 작은 값을 할당해준다. 그 다음 프로세스가 열려있는 파일에 시스템 콜을 이용해서 접근할 때, 파일 디스크립터(FD)값을 이용해서 파일을 지칭할 수 있다.
출처 : 파일 디스크립터란 무엇인가?
getaddrinfo
addrinfo struct
getnameinfo
Freeaddrinfo
IPv4, IPv6
./hostinfo www.facebook.com
DNS 서버는 전세계에 서버들이 있고 큰 회사들이 관리하며 제공하는 서버도 계속 돌아가면서 다르게 제공하면서 부하를 감당한다고 함
Stateless?
Idea that each request sent from a client to a server contains all the necessary information for the server to fulfill that request, without the need for the server to store any information about previous requests from the same client.
This means that the server doesn't maintain any session data or context between requests from the same client. Instead, each request is handled independently, and the server processes the request based only on the information contained in that particular request. Once the server sends the response to the client, it no longer has any memory of that request.
The stateless nature of HTTP is what makes it a scalable and efficient protocol, as it allows for multiple requests to be processed simultaneously without the server having to maintain any additional information about previous requests. However, it also means that certain types of interactions, such as maintaining user sessions or tracking user activity, require additional mechanisms to be implemented by application developers.
Connection - Request - Response - Close
An HTTP Transaction - CMU
깊게 공부하자면 정말 많은 내용들은 공부해야하는 것 같다. 우선 코치님이 조언하신 대로 너무 깊거나 너무 넓게 공부하지 말고 현재 필요한 정도로만 공부하고 넘어가야할 것 같다.
우선은 이번주 과제를 완수해야하니 Network에 대해서는 다음에 기회가 될 때 더 파보는걸로 하고 일단 넘어가자..! ㅠ
Reading List :
https://www.thetechplatform.com/post/what-is-http-protocol-architecture-and-components-of-http
CGI is an application-level protocol used by web servers to execute external programs or scripts and generate dynamic content in response to a client's HTTP request.
(It is not directly related to any of the layers in the OSI model, although it is often used in conjunction with application-level protocols such as HTTP, which operates at the application layer.)
(이부분은 책을 읽어도 하나도 모르겠다...)
=> 그러니까, HTTP request에 대해서 response를 보내줄 때, external 프로그램/스크립트 등을 실행해서 dynamic하게 content를 생성해서 보내주는 것에 대한 protocol(규약)
request를 보내는 방법에 대해서도 rule이 있을거고, 정해진 rule에 맞춰 요청이 잘 들어왔다면 그거에 맞춰서 서버는 처리를 할거고, 그 response를 보내는 것에도 (아마도) rule이 있겠네!
HTTP도 프로토콜이고 지금 막 책에서 읽기 시작한 CGI도 프로토콜이고.. TCP/IP도 프로토콜이고... 이 프로토콜(통신 규약)이라는게 왜이렇게 많고 서로 뭐가 다르고 각각의 카테고리는 뭐길래?
=> Now I know they are all "protocols" of different kinds but note that CGI is not part of the OSI model.
OSI Model : Open Systems Interconnection reference model
The OSI model divides the complex task of computer-to-computer communications, traditionally called internetworking, into a series of stages known as layers.
Layers in the OSI model are ordered from the lowest layer to highest.
Physical Layer
The lowest layer of the OSI Model is concerned with electrically or optically transmitting raw unstructured data bits across the network from the physical layer of the sending device to the physical layer of the receiving device.
Data Link Layer
At the data link layer, directly connected nodes are used to perform node-to-node data transfer where data is packaged into frames. The data link layer also corrects errors that may have occurred at the physical layer.
The data link layer encompasses two sub-layers of its own. The first, media access control (MAC), provides flow control and multiplexing for device transmissions over a network. The second, the logical link control (LLC), provides flow and error control over the physical medium as well as identifies line protocols.
Network Layer
The network layer is responsible for receiving frames from the data link layer, and delivering them to their intended destinations among based on the addresses contained inside the frame. The network layer finds the destination by using logical addresses, such as IP (internet protocol). At this layer, routers are a crucial component used to quite literally route information where it needs to go between networks.
Transport Layer
The transport layer manages the delivery and error checking of data packets. It regulates the size, sequencing, and ultimately the transfer of data between systems and hosts. One of the most common examples of the transport layer is TCP or the Transmission Control Protocol.
Session Layer
The session layer controls the conversations between different computers. A session or connection between machines is set up, managed, and termined at layer 5. Session layer services also include authentication and reconnections.
Presentation Layer
The presentation layer formats or translates data for the application layer based on the syntax or semantics that the application accepts. Because of this, it at times also called the syntax layer. This layer can also handle the encryption and decryption required by the application layer.
Application Layer
At this layer, both the end user and the application layer interact directly with the software application. This layer sees network services provided to end-user applications such as a web browser or Office 365. The application layer identifies communication partners, resource availability, and synchronizes communication.
Reading List
(정글 DOCS)
(정글 docs 가장 마지막에 있던 질문인데.. 아직 이거에 대해서 대답할 수 있을 정도로 개념이 잡히지 않은 것 같다.. ㅠㅠ)