Socket : Network layer와 그 위와의 통신(양방향)

컴퓨터 간의 정보를 주고 받는 것 + IPC

Berkeley Socket API(1:1)

Untitled

Functions

  1. socket() : socket 생성. creates an endpoint for communication and returns a ‘file descriptor’ for the socket

Domain

Type

Protocol

: c++에서 사용. 옵션을 주지 않으면 Type에 따라 정해진다

  1. bind() : OS 와 연결

    socket()으로는 아직 주소를 할당받지 못한 상태.

    다른 host와 연결 이전에 bind() 필요. 성공하면 0 return, 실패시 -1 return

    Function

  2. listen() : 서버측에서 TCP socket과 bound

    Function