๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐“ก๐“ธ๐“ธ๐“ถ5: ๐’ฆ๐‘œ๐“‡๐‘’๐’ถ ๐’ฐ๐“ƒ๐’พ๐“‹/Computer Network(COSE342)

[์ปดํ“จํ„ฐ๋„คํŠธ์›Œํฌ] CH3. Transport Layer (#1)

Overview

1. Transport services and Protocols

  • ์„œ๋กœ ๋‹ค๋ฅธ ํ˜ธ์ŠคํŠธ๋“ค์˜ ์‹คํ–‰์ค‘์ธ ์•ฑ ํ”„๋กœ์„ธ์Šค ๊ฐ„์˜
    logical communication์„ ์ œ๊ณตํ•œ๋‹ค
  • Transport protocols in end sides
    • Sender : ๋ฉ”์‹œ์ง€๋ฅผ ๋ถ€๋ถ„(segments)๋กœ ์ž˜๋ผ์„œ network layer์—๊ฒŒ ๋„˜๊ฒจ์คŒ
    • Receiver : ํฉ์–ด์ ธ์žˆ๋Š” ์กฐ๊ฐ๋“ค์„ ๋ชจ์•„ ๋ฉ”์‹œ์ง€๋กœ ๋งŒ๋“ค์–ด์„œ app layer์— ๋„˜๊ฒจ์คŒ

Internet Transport-Layer Protocols

  1. TCP
    • Reliable, in-order delivery
    • ํ˜ผ์žก ์ œ์–ด (Congestion control)
    • ํ๋ฆ„ ์ œ์–ด (Flow control)
    • Connecition setup ํ•„์š”
  2. UDP
    • Unreliable, unordered delivery
    • "best-effort" IP ์˜ ๊ธฐ๋Šฅ ํ™•์žฅ์ด ์—†๋‹ค

๋‘˜ ๋‹ค

  • ์ง€์—ฐ์— ๋Œ€ํ•œ ๋ณด์žฅ X (No delay guarantees)
  • ๋Œ€์—ญํญ ๋ณด์žฅ X (No bandwidth guarantees)

2. Multiplexing and demultiplexing

Multiplexing at sender

: ์—ฌ๋Ÿฌ ์†Œ์ผ“์—์„œ data๋ฅผ ๊ด€๋ฆฌํ•˜๊ณ , transport header์„ ์ถ”๊ฐ€ํ•œ๋‹ค
์ด ๋•Œ ์ถ”๊ฐ€ํ•œ ํ—ค๋”๋ฅผ receiver์—์„œ demultiplexing ํ•˜๋Š”๋ฐ ์‚ฌ์šฉํ•œ๋‹ค.

Demultiplexing at receiver

: ํ—ค๋”์˜ ์ •๋ณด๋ฅผ ํ™œ์šฉํ•ด์„œ ์ ์ ˆํ•œ ์†Œ์ผ“์œผ๋กœ segments๋ฅผ ์ „๋‹ฌํ•œ๋‹ค.

Demultiplexing ์˜ ์ž‘๋™ ๋ฐฉ๋ฒ•

  1. ํ˜ธ์ŠคํŠธ๋Š” IP datagrams์„ ๋ฐ›๋Š”๋‹ค.
    • ๊ฐ datagram์€ source IP์™€ dest IP ์ฃผ์†Œ, ํฌํŠธ๋„˜๋ฒ„๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค
    • ๋˜ ๊ทธ๋“ค์€ ํ•˜๋‚˜์˜ transport-layer segment๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค
  2. ํ˜ธ์ŠคํŠธ๋Š” IP ์ฃผ์†Œ์™€ ํฌํŠธ ๋„˜๋ฒ„๋ฅผ ์ด์šฉํ•ด์„œ ์ด segment๋ฅผ ์ ์ ˆํ•œ ์†Œ์ผ“์œผ๋กœ ๋ณด๋‚ด์ค€๋‹ค.

Connectionless Demultiplexing // ์—ฐ๊ฒฐ ์—†๋Š” ๋””๋ฉ€ํ‹ฐํ”Œ๋ ‰์‹ฑ (UDP)

Recall

  • ๋งŒ๋“ค์–ด์ง„ ์†Œ์ผ“์€ ํ˜ธ์ŠคํŠธ์˜ ๋กœ์ปฌ ํฌํŠธ ๋„˜๋ฒ„๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค.
    DatagramSocket mySocket1 = new DatagramSocket(12534);
  • datagram์„ ๋งŒ๋“ค์–ด์„œ UDP ์†Œ์ผ“์œผ๋กœ ๋ณด๋‚ด๋ ค๋ฉด Destination IP ์ฃผ์†Œ์™€ ํฌํŠธ ๋„˜๋ฒ„๋ฅผ ์ง€์ •ํ•ด์ค˜์•ผ ํ•จ.
  • ํ˜ธ์ŠคํŠธ๊ฐ€ UDP segment๋ฅผ ๋ฐ›์œผ๋ฉด ์ผ๋‹จ segment์— ์žˆ๋Š” ๋ชฉ์  ํฌํŠธ ๋„˜๋ฒ„๋ฅผ ์ฒดํฌํ•˜๊ณ 
  • UDP segment๋ฅผ ๊ทธ ํฌํŠธ ๋„˜๋ฒ„๋ฅผ ๊ฐ€์ง„ ์†Œ์ผ“์œผ๋กœ ๋ณด๋‚ธ๋‹ค

-> ๋งŒ์•ฝ IP datagram์ด ๊ฐ™์€ ๋ชฉ์  ํฌํŠธ ๋„˜๋ฒ„๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค๋ฉด source IP address๋‚˜ source port #๊ฐ€ ๋‹ค๋ฅด๋”๋ผ๋„ ๊ฐ™์€ ์†Œ์ผ“์— ๋“ค์–ด๊ฐ„๋‹ค.

Connection-Oriented Demux // ์—ฐ๊ฒฐ ์ง€ํ–ฅ ๋””๋จน์Šค (TCP)

  1. TCP ์†Œ์ผ“์€ "source IP address, source port #, dest IP address, dest port #" ๋กœ ๊ตฌ๋ณ„๋œ๋‹ค
  2. demux : receiver๋Š” ์ด 4๊ฐœ์˜ ๊ฐ’์„ ์ ์ ˆํ•œ ์†Œ์ผ“์„ ์ฐพ๋Š”๋ฐ ์ „! ๋ถ€ ! ์ด์šฉํ•œ๋‹ค!
  3. ์„œ๋ฒ„ ํ˜ธ์ŠคํŠธ๋Š” ๋™์‹œ์— ์—ฌ๋Ÿฌ๊ฐœ์˜ TCP ์†Œ์ผ“์„ ๊ฐ๋‹นํ•  ์ˆ˜ ์žˆ๋‹ค.
  4. ์›น ์„œ๋ฒ„๋Š” ์—ฐ๊ฒฐํ•˜๋Š” ํด๋ผ์ด์–ธํŠธ์— ๋”ฐ๋ผ์„œ ๋‹ค๋ฅธ ์†Œ์ผ“์„ ๊ฐ€์ง„๋‹ค.
    (non-persistent HTTP๋Š” request๋งˆ๋‹ค ์†Œ์ผ“์ด ๋‹ค๋ฅด๋‹ค)

๋ชฉ์ ์ง€๊ฐ€ ๊ฐ™์•„๋„ source๊ฐ€ ๋‹ค๋ฅด๋ฉด ๋‹ค๋ฅธ socket์œผ๋กœ ๊ฐ
์—ฌ๋Ÿฌ๊ฐœ์˜ ์†Œ์ผ“์„ ๋™์‹œ์— ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ threaded server ! (multiple process ์‚ฌ์šฉ)

UDP : User Datagram Protocol [RFC 768]

1. Protocol

  • ๊พธ๋ฐˆ ์—†์Œ, ๊ทธ์ € ๋งจ ๋ผˆ (No frills, bare bones)
    ์“ธ๋ฐ ์—†๋Š” ๊ธฐ๋Šฅ ์‹น ๋นผ๊ณ  ์ง„์งœ ํ•„์š”ํ•œ ๊ฒƒ๋งŒ ์žˆ๋Š” Internet Transport Protocol
  • "Best effort" service
    • UDP segments๋Š” lost, delivered out-of-order to app
  • Connectionless
    • sender์™€ receiver๊ฐ„์˜ Handshaking ๊ณผ์ •์ด ์—†์Œ
    • ๊ฐ UDP segment๋Š” ์„œ๋กœ์„œ๋กœ์—๊ฒŒ ๋…๋ฆฝ์ ์œผ๋กœ ๊ด€๋ฆฌ๋œ๋‹ค.
  • UDP ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๋“ค : Streaming multimedia apps (์†์‹ค ํ—ˆ์šฉ,์†๋„์— ๋ฏผ๊ฐ) , DNS, SNMP ๋“ฑ...
  • UDP๋กœ ์‹ ๋ขฐ์„ฑ ์žˆ๋Š” ์ „์†ก์„ ํ•˜๊ณ ์‹ถ๋‹ค๋ฉด?
    • application layer์—์„œ ์‹ ๋ขฐ์„ฑ์„ ์ค„ ์ˆ˜ ์žˆ๋‹ค.
    • application-specific error recovery. (ํŠน์ • application์— ํ•œํ•œ ์—๋Ÿฌ ๋ฐœ๊ฒฌ..)

UDP Segment Header

* length : Header๋ฅผ ํฌํ•จํ•œ UDP segment ์ „์ฒด์˜ ๊ธธ์ด(bytes)

UDP ์™œ ์”€?

  1. ์—ฐ๊ฒฐ ์„ค์ •์ด ํ•„์š” ์—†์Œ (์—ฌ๊ธฐ์„œ ๋”œ๋ ˆ์ด ๊ฐ์†Œ)
  2. ๊ฐ„๋‹จํ•˜๋‹ค. sender๊ณผ receiver๊ฐ„์˜ ์—ฐ๊ฒฐ ์ƒํƒœ๊ฐ€ ์—†๋‹ค
  3. ํ—ค๋”์˜ ํฌ๊ธฐ๊ฐ€ ์ž‘๋‹ค
  4. ํ˜ผ์žก ์ œ์–ด๊ฐ€ ์—†๋‹ค : UDP๋Š” ์›ํ•˜๋Š” ๋งŒํผ ๋น ๋ฅด๊ฒŒ ๋ณด๋‚ผ ์ˆ˜ ์žˆ๋‹ค.

2. Checksum : for detect "error" in transmitted segment

  • Sender
    1. header fields๋ฅผ ํฌํ•จํ•œ ๋ชจ๋“  segment content๋ฅผ 16-bit ์ •์ˆ˜๋กœ ์ทจ๊ธ‰ํ•œ๋‹ค
    2. Checksum : segment contents๋ฅผ ๋”ํ•œ ๊ฐ’(๋ณด์ˆ˜ ํ•ฉ)
    3. sender๋Š” ์ด checksum ๊ฐ’์„ UDP checksum field์— ๋„ฃ์–ด์„œ ๋ณด๋‚ธ๋‹ค.
  • Receiver
    1. ๋ฐ›์€ segment์˜ checksum์„ ๊ณ„์‚ฐ์„ ํ•œ๋‹ค
    2. ๊ณ„์‚ฐํ•œ checksum์ด ๋ฐ›์€ checksum field ๊ฐ’๊ณผ ๊ฐ™์€์ง€๋ฅผ ํ™•์ธํ•œ๋‹ค.
    3. ๊ฐ™๋‹ค๋ฉด ์˜ค๋ฅ˜๊ฐ€ ์—†๋‹ค, ๋‹ค๋ฅด๋‹ค๋ฉด ์˜ค๋ฅ˜๊ฐ€ ์žˆ๋‹ค. (๋ฌผ๋ก  ๊ฐ™๋‹ค๊ณ  ์—๋Ÿฌ๊ฐ€ 100ํผ์„ผํŠธ ์—†๋Š”๊ฑด ์•„๋‹˜)

receiver๋Š” ๋งจ ์œ„์˜ ๋‘ segment๋ฅผ ์ •์ˆ˜ํ™” ํ•œ ๊ฒƒ๊ณผ checksum ๊ฐ’์„ ๋ฐ›๊ฒŒ ๋œ๋‹ค.
๋‘ segment๋ฅผ ๋”ํ•œ ๋’ค carryout๋˜๋Š” ์ˆซ์ž 1์€ sum result์— ๋”ํ•œ๋‹ค
๊ทธ ๋”ํ•œ ๊ฐ’๊ณผ checksum์„ ๋”ํ–ˆ์„ ๋•Œ 111...1 ์ด ๋‚˜์˜ค๋ฉด ์„ฑ๊ณต์ ์œผ๋กœ ๋ฐ›์€ ๊ฒƒ!

Reliable data Transfer

Reliable data Transfer์˜ ์›๋ฆฌ

  • application, transport, link ๊ณ„์ธต์˜ ์ค‘์š”์„ฑ
    • ๊ฐ€์žฅ ์ค‘์š”ํ•œ networking topics TOP 10 ์ค‘ ํ•˜๋‚˜!!
  • application layer๋Š” reliable channel๋กœ ์„œ๋น„์Šค๋ฅผ ์ œ๊ณตํ•˜์ง€๋งŒ,
    transport layer๋Š” unreliable channel์ž„.
    ๋”ฐ๋ผ์„œ ์ด ๊ฐญ์„ ํ•จ์ˆ˜๋“ค๋กœ ์ฑ„์›Œ์ค˜์•ผํ•จ
  • ์ด๋ ‡๊ฒŒ ์ฑ„๋„์ด unreliableํ•˜๋‹ค๋Š” ํŠน์„ฑ์ด reliable data transfer protocol(rdt)์˜ ๋ณต์žก์„ฑ์„ ๊ฒฐ์ •ํ•˜๊ฒŒ ๋จ..

Getting Started

  • Sender
    1. rdt_send() : app์— ์˜ํ•ด ๋ถˆ๋ ค์ง„๋‹ค. data๋ฅผ ์ „์†กํ•˜๊ธฐ ์œ„ํ•ด ์•„๋ž˜๋กœ ๋„˜๊ฒจ์ค€๋‹ค.
    2. udt_send() : rdt์— ์˜ํ•ด ๋ถˆ๋ ค์ง„๋‹ค. unreliable channel์„ ํ†ตํ•ด ํŒจํ‚ท์„ receiverํ•œํ…Œ ๋ณด๋‚ธ๋‹ค.
  • Receiver
    1. rdt_rcv() : ํŒจํ‚ท์ด rcv-side์— ๋„์ฐฉํ–ˆ์„ ๋•Œ ๋ถˆ๋ ค์ง„๋‹ค.
    2. deliver_data() : rdt์— ์˜ํ•ด์„œ ๋ถˆ๋ ค์ง„๋‹ค. ๋ฐ์ดํ„ฐ๋ฅผ ์œ„ ๊ณ„์ธต๋กœ ์˜ฌ๋ฆฌ๋ ค ํ•œ๋‹ค.
  • reliable data transfer protocol (rdt)๋Š” sender์™€ receiver ์–‘ ์ชฝ์„ ์ ์ฐจ ๋ฐœ์ „์‹œ์ผœ ๋‚˜๊ฐ!
  • ๋‹จ๋ฐฉํ–ฅ ๋ฐ์ดํ„ฐ ์ „์†ก๋งŒ ์ƒ๊ฐํ•œ๋‹ค. (๊ทธ๋Ÿฌ๋‚˜ control info๋Š” ์–‘์ชฝ ๋ฐฉํ–ฅ์œผ๋กœ ํ๋ฅธ๋‹ค!)
  • sender์™€ receiver๋ฅผ ๋ช…์‹œํ•˜๊ธฐ ์œ„ํ•ด์„œ finite state machines (FSM)์„ ์‚ฌ์šฉํ•  ๊ฒƒ์ด๋‹ค!

์–ด๋–ค ์•ก์…˜์ด ์žˆ์„ ๋•Œ state๊ฐ€ ๋ณ€ํ•˜๊ฑฐ๋‚˜ ์œ ์ง€๋˜๊ฑฐ๋‚˜ ํ•œ๋‹ค.

1. rdt1.0 : Reliable Transfer over a Errorless channel(Reliable Channel)

  • ์ด channel์€ ์™„๋ฒฝํ•˜๊ฒŒ reliable ํ•  ๊ฒƒ์„ ๊ฐ€์ •ํ•œ๋‹ค. (No bit errors, no loss of packets)

  • sender๋Š” ๊ณ„์† ๊ธฐ๋‹ค๋ฆฌ๋‹ค๊ฐ€ rdt_send(data)๊ฐ€ ๋ถˆ๋ฆฌ๋ฉด packet์„ ๋งŒ๋“ค์–ด์„œ udt_send(packet)์œผ๋กœ receiverํ•œํ…Œ ํŒจํ‚ท์„ ๋ณด๋‚ธ๋‹ค.
  • receiver๋Š” ๊ณ„์† ๊ธฐ๋‹ค๋ฆฌ๋‹ค๊ฐ€ rdt_rcv(packet)์ด ๋ถˆ๋ฆฌ๋ฉด ํŒจํ‚ท์ด ๋„์ฐฉํ–ˆ๋‹ค๋Š” ๊ฒƒ์ด๋ฏ€๋กœ packet์„ ๋ถ„ํ•ดํ•ด์„œ data๋ฅผ ๋ฝ‘์•„์„œ deliver_data(data)๋กœ ์ƒ์œ„ ๊ณ„์ธต์—๊ฒŒ ์ „๋‹ฌํ•œ๋‹ค.

2. rdt2.0: Channel with Bit errors

  1. ์ด channel์€ ํŒจํ‚ท์˜ bits๊ฐ€ ๋’ค์ง‘ํž ์ˆ˜ ์žˆ๋Š” ๊ณณ!
    • ์šฐ๋ฆฌ๋Š” ์ด bit errors์„ ์ฐพ๊ธฐ ์œ„ํ•ด checksum์„ ์“ธ ๊ฒƒ!
  2. ์–ด๋–ป๊ฒŒ ERROR๋ฅผ recoverํ• ๊ฑด๋ฐ?
    • Acknowledgements (ACKs) : sender์—๊ฒŒ pkt ์ž˜ ๋ฐ›์•˜๋‹ค๊ณ  ๋Œ€๋‹ตํ•ด์คŒ
    • Negative acknowledgements (NAKs) : sender์—๊ฒŒ pkt์— ๋ฌธ์ œ๊ฐ€ ์žˆ๋‹ค๊ณ  ๋งํ•ด์คŒ
    • sender๋Š” NAK๋ฅผ ๋ฐ›์œผ๋ฉด ๋‹ค์‹œ ๋ณด๋‚ธ๋‹ค

1. sender๋Š” ์œ„์—์„œ์˜ call์„ ๊ธฐ๋‹ค๋ฆฌ๋‹ค๊ฐ€ rdt_send(data)๊ฐ€ ํ˜ธ์ถœ๋˜๋ฉด udt_send(sndpkt)์„ ๋ณด๋‚ธ๋‹ค.

2. ๊ทธ๋ฆฌ๊ณ  ACK ๋˜๋Š” NCK๋ฅผ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์ƒํƒœ๋กœ ์ „ํ™˜๋œ๋‹ค.
.

3. receiver๋Š” rdt_rcv(rcvpkt)์œผ๋กœ ํŒจํ‚ท์„ ๋ฐ›๊ณ  notcorrupt(rcvpkt)์œผ๋กœ ํŒจํ‚ท์— ์ด์ƒ์ด ์—†๋Š”์ง€ ํ™•์ธํ•œ๋‹ค.

4. ์ด์ƒ์ด ์žˆ๋‹ค๋ฉด udt_send๋กœ NAK๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ณ , ์ด์ƒ์ด ์—†๋‹ค๋ฉด data๋ฅผ deliver_data(data)๋กœ ์œ„๋กœ ์˜ฌ๋ฆฐ๋‹ค์Œ์— ACK๋ฅผ ๋ณด๋‚ธ๋‹ค.

.

5. sender๋Š” rdt_rcv(rcvpkt)์œผ๋กœ ์–ด๋–ค ํŒจํ‚ท์ด ์™”์Œ์„ ํ™•์ธํ•˜๊ณ  ๋งŒ์•ฝ ์ด ํŒจํ‚ท์ด NAK์ด๋ฉด ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š”๊ฑฐ๋‹ˆ๊นŒ ๋‹ค์‹œ udt_send(sndpkt)ํ•ด์ค€๋‹ค.

6. ๋งŒ์•ฝ NAK๊ฐ€ ์•„๋‹ˆ๋ผ ACK๋ผ๋ฉด ์ •์ƒ์ ์œผ๋กœ ๊ฐ„๊ฑฐ๋‹ˆ๊นŒ ๋‹ค์‹œ ๋Œ€๊ธฐ ์ƒํƒœ๋กœ ์ „ํ™˜๋œ๋‹ค.

2-1. rdt2.1 : receiver, Handles Garbled ACK/NAKs

Fatal Flaw!!!!

๋งŒ์•ฝ ACK/NAK๊ฐ€ ์ค‘๊ฐ„์— ์‚ฌ๋ผ์ง€๋ฉด ????

  • sender๋Š” ๋Œ€์ฒด ์ด receiverํ•œํ…Œ ๋ฌด์Šจ ์ผ์ด ๋ฒŒ์–ด์ง„ ๊ฑด์ง€ ์•Œ ์ˆ˜ ์—†์Œ !!
  • ๊ทธ๋ƒฅ ๋‹ค์‹œ ๋ณด๋‚ด?
    • ๋งŒ์•ฝ receiver๊ฐ€ ์ฒ˜์Œ ๋ณด๋‚ธ ๊ฒƒ๊ณผ ๋‹ค์‹œ ๋ณด๋‚ธ ๊ฒƒ ๋‘๊ฐœ๋ฅผ ๋‹ค ๋ฐ›์œผ๋ฉด ์ด๊ฒŒ ์žฌ์ „์†ก๋œ ํŒจํ‚ท์ธ์ง€, ์•„๋‹ˆ๋ฉด ๋™์ผํ•œ ๋‚ด์šฉ์„ ๊ฐ€์ง„ ์ƒˆ๋กœ์šด ํŒจํ‚ท์ธ์ง€ ์•Œ ์ˆ˜๊ฐ€ ์—†์Œ
    • ์ด๋ ‡๊ฒŒ ์ค‘๋ณต ์œ„ํ—˜์„ฑ ๋•Œ๋ฌธ์— ๋ฌด์กฐ๊ฑด retransmit ํ•  ์ˆ˜ ์—†์Œ!!

Handling Duplicates

  1. Sender๊ฐ€ ACK/NAK๋ฅผ ๋ฐ›์ง€ ๋ชปํ•  ๊ฒฝ์šฐ ๋‹ค์‹œ ํŒจํ‚ท์„ ์žฌ์ „์†ก ํ•œ๋‹ค.
  2. ๋Œ€์‹  ์ด ๋•Œ ์ด ํŒจํ‚ท์— sequence number๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค!
  3. receiver๋Š” ์ด seq. no.๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ค‘๋ณต๋œ ํŒจํ‚ท์„ ์—†์• ๋ฒ„๋ฆฐ๋‹ค.

stop and wait : sender๊ฐ€ ํ•˜๋‚˜์˜ ํŒจํ‚ท์„ ๋ณด๋‚ด๋ฉด receiver์˜ response๋ฅผ ๊ธฐ๋‹ค๋ฆฐ๋‹ค.

๋ณต์žกํ•ด๋ณด์ด์ง€๋งŒ ์ด์ „๊ฒƒ๊ณผ ๋‹ฌ๋ผ์ง„ ๊ฒƒ์€ Sequence number๋ฅผ ๊ฒ€์‚ฌํ•œ๋‹ค๋Š” ๊ฒƒ!
seq0 ํŒจํ‚ท์„ ๋ฐ›์•˜์„ ๋•Œ 1์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์ƒํƒœ์˜€๋‹ค๋ฉด ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜์ง€ ์•Š๊ณ  ACK๋ฅผ ๋‹ค์‹œ ๋ณด๋‚ด์ค€๋‹ค. (์ด๋ฏธ ๋ฐ›์•„์„œ ACK ๋ณด๋ƒˆ์—ˆ๋Š”๋ฐ ๊ทธ ACK๊ฐ€ ์‹ค์ข…๋œ๊ฑฐ๋‹ˆ๊นŒ!)
seq0 ํŒจํ‚ท์„ ๋ฐ›์•˜์„ ๋•Œ ์›๋ž˜๋Œ€๋กœ 0์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์ƒํƒœ์˜€๋‹ค๋ฉด ๋ฐ์ดํ„ฐ๋ฅผ ์œ„๋กœ ์ „์†กํ•ด์ฃผ๊ณ  1์„ ๋Œ€๊ธฐํ•˜๋Š” ์ƒํƒœ๋กœ ์ „ํ™˜ํ•œ๋‹ค.

seq1 ํŒจํ‚ท๋„ ๋งˆ์ฐฌ๊ฐ€์ง€!

Discussion

  • Sender
  1. ํŒจํ‚ท์— seq #๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ์Œ
  2. ๊ทผ๋ฐ 0, 1์ด๋ฉด ์ถฉ๋ถ„ํ•ด??? ์™œ?
  3. ์™œ๋ƒ๋ฉด ํ™•์ธํ•ด์•ผ ํ•  ๊ฒƒ์€ ACK/NAK๊ฐ€ ์ž˜ ๊ฐ”๋Š”์ง€ ์•ˆ๊ฐ”๋Š”์ง€๋‹ˆ๊นŒ
  4. sender๋Š” ์˜ˆ์ƒ ํŒจํ‚ท์ด 0์ผ์ง€ 1์ผ์ง€๋งŒ ๊ธฐ์–ตํ•˜๋ฉด ๋จ
  • Receiver
  1. ์ˆ˜์‹ ๋œ ํŒจํ‚ท์ด ์ค‘๋ณต์ธ์ง€ ์•„๋‹Œ์ง€ ํ™•์ธํ•œ๋‹ค
    • state๊ฐ€ ๊ฐ€๋ฆฌํ‚ค๋Š” 0๋˜๋Š” 1์€ ์˜ˆ์ƒ ํŒจํ‚ท์˜ seq #
  2. ์ฐธ๊ณ ๋กœ receiver๋Š” ๋งˆ์ง€๋ง‰ ACK/NAK๊ฐ€ sender์—๊ฒŒ ์ž˜ ๋„์ฐฉํ–ˆ๋Š”์ง€ ์•Œ ์ˆ˜ ์—†๋‹ค.

2-2. rdt2.2 : a NAK-free Protocol

  • ๊ธฐ๋Šฅ์ ์œผ๋กœ๋Š” 2.1๊ณผ ๊ฐ™์€๋ฐ ์ด๊ฑด NAK ์—†์ด ACK๋งŒ ์‚ฌ์šฉํ•จ
  • NAK ๋Œ€์‹ ์—, receiver๋Š” ๋งˆ์ง€๋ง‰ ํŒจํ‚ท์ด ์ž˜ ๋„์ฐฉํ–ˆ๋Š”์ง€์— ๋Œ€ํ•œ ACK ์‘๋‹ต๋งŒ ๋ฐ›์Œ
    (ACK ํŒจํ‚ท ์•ˆ์—๋Š” seq # ๊ฐ€ ํฌํ•จ๋˜์–ด์•ผ ๊ฒ ์ฅฌ)
  • Sender์—๊ฒŒ ACK๊ฐ€ ์ค‘๋ณต๋˜๋ฉด NAK์™€ ๋™์ผํ•œ ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์˜จ๋‹ค.
    Sender๋Š” ํ˜„์žฌ ํŒจํ‚ท์„ ๋‹ค์‹œ ์žฌ์ „์†กํ•œ๋‹ค.

  1. ์•ž์—๊นŒ์ง„ ๋‹ค ๋˜‘๊ฐ™๋‹ค. 1 ๋Œ€๊ธฐ์ƒํƒœ์— ์žˆ์„ ๋•Œ receiver๊ฐ€ pkt seq1์„ ์ •์ƒ์ ์œผ๋กœ ๋ฐ›์œผ๋ฉด ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๊ณ  ACK1, chksum์„ ์ „์†กํ•œ๋‹ค.
  2. ๋งŒ์•ฝ ์ด๋ฏธ ๋ณด๋‚ด์„œ 0 ๋Œ€๊ธฐ์ƒํƒœ์— ์™”๋Š”๋ฐ seq1 ํŒจํ‚ท์„ ๋ฐ›๊ฑฐ๋‚˜ ํŒจํ‚ท์ด corruptํ–ˆ์œผ๋ฉด ๋ฐ์ดํ„ฐ๊ฐ€ ์ค‘๋ณต๋๊ฑฐ๋‚˜ ์ž˜๋ชป๋๋‹ค๋Š” ๊ฒƒ์ด๋ฏ€๋กœ(ACK ์‹ค์ข…) ๋‹ค์‹œ udt_send(sndpkt)์„ ๋ณด๋‚ด์ค€๋‹ค. (sndpkt ์€ ACK1, checksum ๊ฐ’)
    .
  3. ํŒจํ‚ท์„ ๋ณด๋‚ด๊ณ  ๋Œ€๊ธฐํ•˜๊ณ  ์žˆ๋˜ sender๋Š” ํ˜„์žฌ ack0์„ ๊ธฐ๋‹ค๋ฆฌ๊ณ  ์žˆ๋‹ค.
  4. ack1์ด ์˜ค๋ฉด ack0์ด ์•ˆ ๊ฐ„๊ฑฐ๋‹ˆ๊นŒ ack0์„ ์žฌ์ „์†กํ•œ๋‹ค. ๋˜๋Š” ack๊ฐ€ ๋ญ”๊ฐ€ ์ž˜๋ชป๋์–ด๋„ ๋‹ค์‹œ ์žฌ์ „์†กํ•œ๋‹ค.
  5. ์ •์ƒ์ ์ธ ack0์ด ์˜ค๋ฉด ack1์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์ƒํƒœ๋กœ ์ด๋™ํ•œ๋‹ค.

3. rdt3.0: Channel with error and "loss"

New Assumption
์ฑ„๋„์—์„œ data์™€ ACKs ๋ฅผ ๋‹ด๋Š” ํŒจํ‚ท๋„ ์‹ค์ข…๋  ์ˆ˜ ์žˆ์ง€ ์•Š์„๊นŒ??

  • checksum, seq.#, ACKs, retransmissions ์ด ๋„์›€์€ ๋˜๊ฒ ์ง€๋งŒ.. ์™„๋ฒฝํ•˜์ง„ ๋ชปํ•ด!
  • Sender/receiver๋Š” ACK๋‚˜ ํŒจํ‚ท ๋ฐ›์„๊ฑธ ๊ธฐ๋‹ค๋ฆฌ๋Š”๋ฐ ์•„๋ฌด๊ฒƒ๋„ ๋ชป ๋ฐ›์„์ˆ˜๋„ ์žˆ๋‹ค.(์˜ˆ๋ฅผ ๋“ค๋ฉด ๋ฒ„ํผ ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ๋กœ ์ธํ•œ ์†์‹ค)

Approach : sender๋Š” ํŒจํ‚ท์„ ๋ณด๋‚ด๊ณ  ACK๋ฅผ "reasonable"ํ•œ ์‹œ๊ฐ„๋™์•ˆ ๊ธฐ๋‹ค๋ ค๋ณธ๋‹ค!

  1. ๋งŒ์•ฝ ACK๊ฐ€ ๊ทธ์‹œ๊ฐ„ ์•ˆ์— ์•ˆ์˜ค๋ฉด retransmits!
    • ์ด ์‹œ๊ฐ„์„ ์„ธ์ค„ countdown timer๊ฐ€ ํ•„์š”ํ•˜๋‹ค!
  2. ACK๋‚˜ ํŒจํ‚ท์ด ๋ถ„์‹ค๋œ๊ฒŒ ์•„๋‹ˆ๋ผ ๋‹จ์ˆœํžˆ ์ง€์—ฐ๋œ ๊ฑธ ์ˆ˜๋„ ์žˆ๋Š”๋ฐ,
    • sender์€ timeout์— ์˜ํ•ด์„œ ์ค‘๋ณต๋˜๋Š” ํŒจํ‚ท์„ retransmit ํ•˜์ง€๋งŒ receiver๋Š” seq.#๋กœ ์ค‘๋ณต์„ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ๋‹ค!!
    • ๋”ฐ๋ผ์„œ Receiver๋Š” ๋ฌด์กฐ๊ฑด ACKed๋ฅผ ๋ฐ›์„ ํŒจํ‚ท์˜ seq.# ์„ ์ง€์ •ํ•ด์„œ ๋ณด๋‚ด์•ผ ํ•œ๋‹ค.

  1. sender๋Š” rdt_rct(rcvpkt) ๋ช…๋ น์ด ๋–จ์–ด์ง€๋ฉด pkt0์„ ๋ณด๋‚ด๊ณ  ํƒ€์ด๋จธ๋ฅผ ํ‚ค๊ณ  ACK0 ์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์ƒํƒœ๋กœ ์ „ํ™˜ํ•œ๋‹ค.
  2. ๋งŒ์•ฝ ACK0์ด ์˜ค๊ณ  ์ •์ƒ์ ์ด๋ผ๋ฉด 1์„ ๋ณด๋‚ด๋ผ๋Š” ๋ช…๋ น์ด ๋–จ์–ด์งˆ ๋•Œ๊นŒ์ง€ ๋Œ€๊ธฐํ•˜๋Š” ์ƒํƒœ๋กœ ์ „ํ™˜ํ•œ๋‹ค.
  3. ๋งŒ์•ฝ ACK๊ฐ€ 1์ด ์˜ค๊ฑฐ๋‚˜ ์ž˜๋ชป๋˜๊ฑฐ๋‚˜ ํ•˜๋ฉด ๊ฐ€๋งŒํžˆ ์žˆ๋Š”๋‹ค.
  4. ๊ทธ๋Ÿฌ๋‹ค timeout์ด ๋˜๋ฉด ๋‹ค์‹œ ํŒจํ‚ท์„ ์žฌ์ „์†กํ•˜๊ณ  ํƒ€์ด๋จธ๋ฅผ ํ‚จ๋‹ค.
  5. rdt_rcv(rcvpkt) ๋ช…๋ น์ด ๋‹ค์‹œ ๋–จ์–ด์งˆ ๋•Œ๊นŒ์ง€ ๋Œ€๊ธฐํ•˜๋‹ค๊ฐ€ pkt1 ์— ๋Œ€ํ•ด์„œ๋„ ๋ฐ˜๋ณต์ž‘์—…!

Stop-and-Wait Operation

  • ํŒจํ‚ท์˜ ์ฒซ ๋ฒˆ์งธ bit ๊ฐ€ ์ „์†ก ์‹œ์ž‘๋˜๋Š” ์‹œ๊ฐ„ t = 0
        ๋งˆ์ง€๋ง‰                            t = L/R
  • ๋งˆ์ง€๋ง‰ bit๊นŒ์ง€ receiver์— ๋„์ฐฉํ•˜๋ฉด ACK๋ฅผ ์ „์†กํ•จ
  • ์ด ๋•Œ ๋งˆ์ง€๋ง‰ bit๋ฅผ ๋ณด๋‚ด๊ณ  ACK๋ฅผ ๋ฐ›์„ ๋•Œ ๊นŒ์ง€์˜ ์‹œ๊ฐ„ = RTT (Round Trip Time)
  • ACK๊ฐ€ ๋„์ฐฉํ•˜๊ณ  ๋‹ค์Œ ํŒจํ‚ท์„ ์ „์†กํ•  ๋•Œ๊นŒ์ง€์˜ ์‹œ๊ฐ„ t = RTT + L/R

ex. 1 Gbps link, 15ms props. delay, 8000 bit packet:

D_trans = L/R = 8000bits/10^9 bits/sec = 8 microsecs
U_sender : utilization (fraction of time sender busy sending) ์ด ๋ญ˜๊นŒ...
= L/R / (RTT+ L/R) = 0.008/30.008 = 0.00027

RTT = 30 msec : ๋งค 30์ดˆ๋งˆ๋‹ค 1kB ํŒจํ‚ท์„ ์ „์†กํ•จ
-> ์ด๊ฒƒ์€ 1 Gbps link์˜ ๋Œ€์—ญํญ์—์„œ 33kB/sec์„ ๋ณด๋‚ผ ์ˆ˜ ์žˆ์Œ์„ ์˜๋ฏธํ•จ

rdt 3.0 ์€ ์ •ํ™•ํ•œ ๋Œ€์‹  ์„ฑ๋Šฅ์ด ์•ˆ์ข‹๋‹ค.