본문 바로가기

나의 FE피봇이야기/Dev_Knowledge

[Network]Socket과 Segment,Packet 등

대명제 : Socket은 a File이다.

문맥에 따라서 Socket의 달라짐.

Bluetooth socket, IRDA socket, TCP socket etc

 

File의 기본 명제

  • Open(Read, Write, execute)
  • Create
  • Close
  • Delete

 

 TCP에서 File == TCP Socekt

--> TCP File 에 대한 입·출력 방법론

- Write == Send / Read == Receive

- 데이터 단위 : stream(각 층에서 사용하는 조각 단위 ex, L4:segment, L3:packet)

 

 

Stackflow

A packet is a chunk of data. All IP networks send data in small chunks across the network. A socket(in relation to TCP/IP) is an abstraction built on top of this, that provides a reliable stream of data.

When using a socket, rather than deal with sending individual packets of data, you just send unlimited streams of data.
The socket implementation deals with splitting it into packets and sending it over the network and handles 

resending packets that are lost on the way.

 

출처

https://stackoverflow.com/questions/38298973/what-is-the-difference-between-a-packet-and-a-socket

 

 

Socket:

  • A socket is a fundamental programming abstraction in networking. It represents an endpoint for sending or receiving data across a computer network.
  • In software development, a socket is used to establish a connection between two devices (usually computers) over a network, allowing them to communicate by sending and receiving data packets.
  • Sockets are commonly used in network programming to create client-server applications, where one device (the server) listens for incoming connections, and other devices (clients) connect to the server to exchange data.

 

  • 소켓은 네트워킹의 기본적인 프로그래밍 추상화입니다. 컴퓨터 네트워크에서 데이터를 송수신하기 위한 엔드포인트를 나타냅니다.
  • 소프트웨어 개발에서 소켓은 네트워크를 통해 두 장치(일반적으로 컴퓨터) 간의 연결을 설정하여 데이터 패킷을 송수신하여 통신할 수 있도록 하는 데 사용됩니다.
  • 소켓은 일반적으로 네트워크 프로그래밍에서 클라이언트-서버 애플리케이션을 만드는 데 사용되며, 한 장치(서버)는 들어오는 연결을 수신 대기하고 다른 장치(클라이언트)는 서버에 연결하여 데이터를 교환합니다.

 

Packet:

  • A packet is a unit of data transmitted over a network. It is a small, discrete piece of data that includes both the actual information being sent and control information for routing and error checking.
  • In networking, data is typically broken down into packets for efficient transmission. Each packet contains a portion of the data and information about its destination, source, and sequence number.
  • Routers and switches in a network use information in the packet's header to determine how to forward it to its intended destination.

 

  • 패킷은 네트워크를 통해 전송되는 데이터의 단위입니다. 패킷은 전송되는 실제 정보와 라우팅 및 오류 확인을 위한 제어 정보를 모두 포함하는 작고 개별적인 데이터 조각입니다.
  • 네트워킹에서 데이터는 효율적인 전송을 위해 일반적으로 패킷으로 나뉩니다. 각 패킷에는 데이터의 일부와 대상, 소스, 시퀀스 번호에 대한 정보가 포함되어 있습니다.
  • 네트워크의 라우터와 스위치는 패킷 헤더에 있는 정보를 사용하여 패킷을 의도한 목적지로 전달할 방법을 결정합니다.

 

출처

 GPT