본문 바로가기
Computer Network/컴퓨터네트워크

[컴퓨터네트워크] 3. Transport Layer (2)

by leziwn.cs 2023. 10. 21.
UDP checksum

▷ Goal: detect errors! (bit error 발생 여부만 판단! error recovery는 하지 않음)

 

▶ Sender: checksum을 만든다.

  1. Treat contents of UDP datagram as sequence of 16-bit integers.
  2. checksum: one's complement sum --> filpping
  3. Sender puts checksum value into UDP checksum field.

▶ Receiver: 같은 방법으로 checksum을 만들고, 받은 checksum과 비교한다.

  1. Compute checksum of received segment.
  2. Check if computed checksum equals checksum field value:
    - Equal: No error detected. (bit error가 없다는 뜻은 아님)
    - Not equal: Error detected.

UDP datagram format

 

The Internet checksum used by TCP & UDP

: Internet checksum은 UDP 뿐만 아니라, IP, TCP에서도 이용한다.

 

▶ Checksum을 만드는 방법:

  1. 16-bit alignment
  2. One's complement addition
  3. One's complement operation (flipping)

 

Internet checksum: example

Internet checksum: example

  1. sum
  2. checksum (flipped sum)

Cf) Bit flipping으로 인한 오류는 실제로 많지 않기 때문에, checksum이면 충분하다.

  • Error의 주 요인: buffer overflow