용어

  • Client : 현재 우리가 사용하는 컴퓨터이며 Sever로부터 요청을 하는 쪽
  • Server : 항시 켜져 있으면서 Clinet의 요청을 대기
  • Packet : 데이터를 보낼 때 한 묶음 편지봉투의 개념
  • Protocol : 암묵적인 룰 이야기하는 방식에 대한 서로간의 약속

network

커다란 네트워크망안에서는 크게 2가지로 나뉜다.

  1. 네트워크 주변 엣지
    • 일반적인 사용자들 언제든지 망안을 들어갔다가 나왔다 할 수 있음.
  2. 네트워크 중심 코어
    • 라우터와 같이 사용자들의 요청을 항시 배달시켜주는 쪽
택배로 생각한다면 네트워크 주변 엣지는 택배를 이용하는 고객 네트워크 중심 코어는 중간중간 택배물류창고

1. The Network Edge

  • Conntection - oriented Service
    TCP
    사용자에게 다음을 제공
    • Reliable 신뢰성(메시지 유실 X)
    • In-order 순서 (보낸 순서를 지켜서 전달)
    • Flow control (보내는 속도를 받는 사람에 맞게 조절)
    • Congestion control (네트워크 상황에 맞게 보내줌)
  • Connetionless Service
    UDP
    사용자에게 다음을 제공
    • Connectionless
    • Unreliable data transfer
    • No flow control
    • No congestion control

위 내용을 보면 UDP 보다 TCP가 더 좋아 보이는데 그렇다면 각자 언제 사용될까?

TCP를 사용하는 Service

  • HTTP(Web)
  • FTP(File transfer)
  • Telnet(remote Login)
  • SMTP(Email)

UDP를 사용하는 Service

  • Streaming Media
  • Teleconferencing
  • DNS
  • Internet Telephony

ex) 만약 미국에 사는 친구에게 편지를 보낸다면 일반우편(UDP) 사용 (단점:중간에 유실가능성)
미국에 사는 친구에게 편지+돈을 함께 보낸다면 등기우편(TCP) 사용 (단점:비싸다) 결론 : Realiable이 필요하다면 TCP사용

2. The Network Core (중심에 있는 Routers)

메시지를 도착지까지 전달하는 2가지 방식이 존재
1. Circuit-Switching

  • 출발 → 목적지까지 가는 길을 미리 예약
  • 유선전화망
  • 특징 : 많은양을 처리할 수 없다

2.Packet-Switching

  • Packet를 받으면 순서대로 목적지까지 보내줌
  • 현재 인터넷에서 사용하는 방식
  • 특징 : 한번에 몰리지 않는다면 제약X 한번에 몰릴 확률 또한 낮다.

※ 인터넷을 Packet-Swticing을 사용하는 이유

많은 인원이 인터넷을 사용하여야 하며 네이버 뉴스를 클릭해서 본다고 가정한다면 우리는 처음을 제외하고는 기사를 읽는동안 데이터를 지속적으로 사용하지 않는다. 또한 모든 인원이 동시에 네이버 기사를 누를 확률은 높지 않다.

Packet-Switcing의 4가지 딜레이 요소 라우터 → 다음 라우터 보낼 시

  1. 전달 받은 Packet의 목적지를 다음 라우터에서 확인
    • Processing delay
      • 해결방안 : 라우터의 성능을 개선 (하이패스 설치)
  2. 들어오는 속도가 나가는 속보보다 많으면 대기자가 생기는데 이를 잠시 저장해 둘 Buffer/Queqe(임시저장소)필요
    • Queueing delay
      • 해결방안 : 사용자 패턴 → 도로를 넓히고 개선하여도 연휴나 휴가철에는 여전히 차가막힘 → 개선하기 힘듬
  3. 첫 bit~마지막 bit가 통과될때까지 걸리는 시간
    • Transmission delay
      • 해결방안 : Band를 확장(차선을 넓히는 행위)
  4. 라우터의 마지막 bit가 다음 라우터까지 도착한 시간
    • Propagation dealy
      • 해결방안 : 건들 수 없음

Caravan analogy 네트워크 상황을 고속도로 톨게이트 10대의 차량과 비교

  • Car = bit
  • Car * 10 = packet
  • Toll booth = routers
  • Limit speed = propagation delay
  1. Cars “Propagate” at 100km/h
  2. Toll booth takes 12sec to service a car(transmission time)
  3. car- bit: caravan - packet time to “push”entire caravan throught toll booth onto highway = 12*10 (Toll booth 처리 속도(12) * 차량 갯수(10))
  4. Time for last car to propagate from 1st to 2nd toll booth =100/km/100km/h = 1hr

Chapter 2: Outline

  • 네트워크 계층(Client → Server)서로간의 통신
    |App| → HTTP
    |Transfort| → TCP/UDP
    |Network| → IP
    |Link| → Wifi/LTE/Ethernet
    |Physical| → …

먼저 최상단에 App에 대해 알아보자.

Some network Apps

e-mail P2P Voice over IP(Skype)
Web Multi-User-Network Games  
Real-time Video Conferencing    
Text Messaging Streaming stored Video(Youtube, Netflix Socail networking
Remote login …. ….

Clinet-Server

  • Server
    • Always-on host → 항상 켜져있어야 함
    • Permanent IP address → 고정된 IP 주소필요
    • Data centers for scaling
  • Clients
    • Communicate with Server
    • May be intermittently connected.
    • do not commumnicate directly with eath other

Sockets

  • Process sends/receives messages to/from its socket.
  • Socket analogous to door
    • Sending process shoves message outdoor.
    • Sending process relies on transport infrastrucure on other side of door to deliver messsage to socket at receiving process

      IP:어떤 컴퓨터인지 ?

      Port : 어떤 프로세스인지?

      ex) www.naver.com
      → IP + Port으로 전환 (보통 port는 80으로 통일 )

네트워크 계층에서 Transport Service 에게 바라는 점

  • data integrity → 현재 제공해주는 기능은 오직 하나 (TCP)
    • Some apps require 100% reliable data transfer → File
      (파일전송과 같이 100퍼센트 데이타 유실이 없어야 함)
    • other apps can tolerate some loss → Audio
      (오디오와 같이 약간의 유실이 허용)
  • Timing
    • Some apps require low delay to be “effective” → interactive game
      (상호작용하는 게임과 같이 딜레가 없어야 함)
  • Throughput → 최소용량
    • Some apps require minimum amout of throughput to be “effective” → Multi media
    • other apps make use of whatever throughput they get → elastic apps
  • Security
    • Encryption, data integrity
HTTP
hypertext transfer protocol
  • PC runnning(file fox browser)

  • iPhone running(sari browser)

  • Server running (Apache Web Server)

HTTP는 TCP Service를 이용하기 때문에 request/response 이전에 TCP connection을 먼저한다.!!

  • 특징 Uses TCP
  • Clinet Initicates TCP Connetion to Server, port 80
  • Server accepts TCP connection from clinet
  • HTTP messages exchaged between browser and web server
  • TCP connecton closed

HTTP is “Stateless”

  • Server maintains no information about past client requests

HTTP connections

HTTP가 TCP connection을 사용하는 방법에 따라 2가지로 나위어진다.
  1. Persistent HTTP(재사용) → 실제 인터넷에서 사용하는 것
    • multiple objects can be sent over single TCP connection between clinet,server
  2. Non-persistent HTTP(재사용 X)
    • at most one object sent over TCP connection → connection then closed
    • Downloading multiple objects required multiple connections.

HTTP가 Clinet 와 Server간의 request/response를 하기 전에는 TCP가 먼저 연결되어야 한다. 그리고 이 때 연결했던 TCP를 계속 유지하는 Persistent 방식이 우리가 사용하는 인터넷 방식이다.