TCP/IP_User Datagram Protocol(UDP)

silups·2025년 3월 25일
0

TCP/IP

목록 보기
11/12

User Datagram

  • UDP packets
  • UDP는 error control, flow control 기능 없음
  • Error checking은 option(checksum 설정)
  • connectionless Simple protocol
    • UDP는 신뢰성이 없음

Source port number: 출발지
Destination port number: 목적지
Total length: 전체 길이
Checksum: Checksum(오류 확인용)

Ex 14.1

The following is a dump of a UDP header in hexadecimal format
CB84000D001C001C

1) What is the source port number?
: CB84 (52,100)
2) What is the destination port number?
: 000D (13)
3) What is the total length of the user datagram?
: 001C (28byte)
4) What is the length of the data?
: 28byte - 8byte(header length) = 20byte
5) Is the packet directed from a client to a server or vice versa?
: Source port number가 well-known port가 아니고 Destination port number는 well-known port임. 따라서 클라이언트 -> 서버
6) What is the client process?
: Daytime (table 14.1 참고)

UDP Checksum

  • UDP의 checksum에는 IP header의 12byte(Source ip, destination ip, protocol)이 포함됨.

    • 이를 Pseudo Header라고 하며, 실제 전송되지는 않고 Checksum 계산 만을 위한 가짜해더이다.
    • well-known port는 TCP와 UDP의 port number가 같기 때문에 protocol 부분이 훼손시, 정상적으로 전달되지 못할 수 있음
  • checksum은 옵션으로 사용자가 선택하여 설정할 수 있음

  • checksum 구하기

예외

1) 사용자가 checksum을 사용하지 않기로 한 경우

  • Checksum을 All 0s로 표기

2) checksum을 설정했는데 sum 값이 All 1s인 경우

  • checksum이 All 0s가 되어 1)의 상황과 겹침
  • 그대로 All 1s 사용

3) checksum을 설정했는데 sum 값이 All 0s인 경우

  • 앞의 header에 어떤 값이라도 들어있어야 하기 때문에 불가능한 경우임

Encapsulation과 Decapsulation

Queues in UDP

  • port 13은 13끼리, port 52000은 52000끼리 통신 (그림 오류임)
  • Queue를 통해 하나씩 순차적으로 송신 및 수신이 이루어짐

Multiplexing과 Demultiplexing

  • UDP도 IP와 마찬가지로 여러 process에서 message를 받을 수 있다
  • 따라서 각각의 process와 맞는 port로 송수신을 해야한다.

UDP 활용

  • 신뢰성이 없는 UDP를 사용하는 경우?
    • error가 나도 크게 상관 없는 경우
    • 간단한 data를 보낼 떄 (header가 8byte로 작음)

사용가능 ex)
1. DNS service

  • server에 짧은 request를 보내기 때문
  • 빠른 응답을 받아야 하기 때문
  • 순서가 어긋나도 상관 없음
  1. short text message
  • 짧고 오류가 나도 간단히 다시 보낼 수 있음
  1. live streaming
  • 약간의 오류를 우리는 눈치채지 못함
  • 실시간인 만큼 빠른 통신이 이루어져야 함

사용 불가 ex)
1. SMTP(메일)

  • 길이가 길어 하나의 User datagram에 맞지 않음
  • 첨부 파일 등 훼손 되지 않게 신뢰성이 중요함
  1. file download
  • 크기가 매우 큼
  • error없이 정확히 통신이 이루어져야 함

UDP Package

  • UDP design
  • 빈 table이 없는 경우 정책에 의해 하나 삭제(너무 오래됐거나 이상한 것)
  • 빈 table이 있는 경우 IN-USE 상태의 process ID, port number를 포함한 entry 등록
  • input module에 user datagram 도착
  • entry가 존재할 경우 queue를 확인(할당 안되어 있으면 할당 후 넘버 기입)하고 해당 port number로 전송
  • 해당 port가 없는 경우 ICMP error message를 전송한다
  • User datagram 생성
  • User datagram 전송
profile
NDBT

0개의 댓글