๐Ÿ“˜ [Computer Network] multiplexing & demultiplexing

๊ณ ๋ฏผ์ •ยท2023๋…„ 11์›” 1์ผ
0

Computer Network

๋ชฉ๋ก ๋ณด๊ธฐ
8/12
post-thumbnail
post-custom-banner

03_1


๐Ÿ’ก How Demultiplexing Works

Demultiplexing
des port number๋ฅผ ๋ณด๊ณ  ์ ์ ˆํ•œ socket์œผ๋กœ ๋ณด๋‚ด์ค€๋‹ค.

  • host receives IP datagrams
    • each datagram has src IP, des IP
    • each datagram carries one transport layer segment
    • each segment has des IP and des port number

๐Ÿ’ก UDP Demultiplexing

UDP๋Š” ๋‹ค๋ฅธ host๊ฐ€ ๋ณด๋‚ด๋„ server์˜ ๊ฐ™์€ socket์œผ๋กœ ๊ฐ„๋‹ค.

๐Ÿ“Œ UDP socket is fully identified by a two tuple
(destination IP adress , destination Port number)

๊ทธ๋Ÿผ ์—ฌ๊ธฐ ์†Œ์Šค ํฌํŠธ๊นŒ์ง€ ์“ฐ๋Š”๊ฑฐ๋ฉด 3 tuple ์•„๋‹Œ๊ฐ€? ์™œ ๋‘ ๊ฐœ์ง€???

Then why use source port number?

server์—์„œ ๋‹ค์‹œ host์—๊ฒŒ ์‘๋‹ต์„ ๋ณด๋‚ด์ค„ ๋•Œ ํ•„์š”ํ•˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.


๐Ÿ’ก TCP Demultiplexing

TCP socket identified by 4 tuple

  • source IP adress
  • source port number
  • destination IP adress
  • destination port number

server host may support many simultaneous TCP sockets
UDP ์ฒ˜๋Ÿผ ํ•˜๋‚˜์˜ socket์œผ๋กœ ๊ฐ€๋Š” ๊ฒƒ์ด ์•„๋‹Œ ๊ฐœ๊ฐœ์ธ์˜ socket์ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๋™์‹œ์— ์—ฌ๋Ÿฌ client๋ฅผ ๋ฐ›์„ ์ˆ˜ ์žˆ๋‹ค.

๐Ÿ“Œ ์™œ UDP๋Š” destination ์ •๋ณด๋งŒ ํ•„์š”๋กœ ํ•˜๋Š”๊ฑธ๊นŒ?

์™œ UDP๋Š” 2 tuple์„ ์š”๊ตฌํ•˜๋ฉด์„œ TCP๋Š” 4 tuple ์ด ํ•„์š”ํ• ๊นŒ?
TCP๋Š” connection์ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.
TCP ์ž…์žฅ์—์„œ๋Š”
( host 1 ) โ†” server โ†” ( host 2 ) ๊ฐ€ ์žˆ์œผ๋ฉด
( host 1 ) โ†” server, server โ†” ( host 2 ) ์˜ connection์ด ๋‹ค๋ฅด๋‹ค๊ณ  ์ทจ๊ธ‰ํ•˜๊ธฐ ๋–„๋ฌธ์ด๋‹ค.

server์˜ socket์€ ๋งค๋ฒˆ ์ƒˆ๋กœ ๋งŒ๋“ค์–ด์ง„๋‹ค.

des IP, des port number ๊นŒ์ง„ ๊ฐ™์œผ๋‚˜ src IP, src port number ๋กœ ๊ตฌ๋ถ„ํ•ด์„œ ๋‹ค๋ฅธ socket์œผ๋กœ ๊ฐ„๋‹ค.

๋งŒ์•ฝ client๊ฐ€ ํฌ๋กฌ์„ ๋“ค์–ด๊ฐ€์„œ ๋‘ ๊ฐœ์˜ page๋กœ ๊ฐ™์€ server์— ์ ‘์†ํ–ˆ๋‹ค๋ฉด des IP, des port number, src IP ๊นŒ์ง€๋Š” ๊ฐ™์œผ๋‚˜ src port number๋งŒ ๋‹ฌ๋ผ์ง€๊ฒŒ ๋œ๋‹ค.

Multiplexing , Demultiplexing is based on segment and datagram header field values


๐Ÿ’ก Web server and TCP

  • Socket vs Process
    ์˜ˆ์ „์˜ Web server ๋Š” 1 process per 1 socket ์ด์—ˆ๋‹ค.
    ํ•˜์ง€๋งŒ ์ตœ๊ทผ์˜ Web server ๋Š” process๋ฅผ socket ์— ํ•˜๋‚˜์”ฉ ๋ถ€์—ฌํ•˜์ง€ ์•Š๊ณ ,
    process ๋ฅผ ํ•˜๋‚˜ ๋‘๊ณ  ์š”์ฒญ์ด ๋“ค์–ด์˜ฌ ๋•Œ ๋งˆ๋‹ค thread ๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ์“ด๋‹ค.
    ์žฅ์  : thread is more light than process

  • persistent HTTP vs non-persistent HTTP
    persistent HTTP ๋Š” connection์ด ๊ณ„์† ์‚ด์•„์žˆ๊ธฐ ๋•Œ๋ฌธ์— same server socket์„ ์“ด๋‹ค.
    non-persistent HTTP ๋Š” ๊ณ„์† connection์ด create / close ๋˜๊ธฐ ๋•Œ๋ฌธ์— socket์„ ์ž์›์„ ๊ณ„์† ํ• ๋‹นํ–ˆ๋‹ค ์ง€์šฐ๊ณ  new socket์„ ํ• ๋‹นํ•˜๊ธฐ์— server ์„ฑ๋Šฅ์ด ์ €ํ•˜๋  ์ˆ˜ ์žˆ๋‹ค.

post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€