Computer Network/컴퓨터네트워크

[컴퓨터네트워크] 2. Application Layer (7)

leziwn.cs 2023. 10. 6. 18:40
Socket Programming with UDP and TCP
Socket Programming

Socket Programming

--> Goal: Communicate using socket.

  • Socket: Door between application process and end-end-transport protocol.

 

▶ Two socket types for two transport services:

  • UDP: unreliable datagram
  • TCP: reliable, byte stream-oriented

 

▷ Application Example:

  1. Client: reads a line of characters (data) from its keyboard, and sends data to server. (요청)
  2. Server: receives the data and converts characters to uppercase, and sends modified data to client. (응답)
  3. Client: receives modified data, and displays line on its screen.

 

 

Socket Programming with UDP

▶ UDP: "no connection" between client and server.

  • Handshaking (x)
  • Server (sender): 각각의 packet에 대한 IP 주소, Port 번호를 붙인다.
  • Client (receiver): 받은 packet에서 sender의 IP 주소와 Port 번호를 추출한다.

 UDP: transmitted data may be lost, received out-of-order.

 

--> Application viewpoint

: UDP provides unreliable transfer of groups of datagrams between client and server.