chapter 2: application layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... ·...
TRANSCRIPT
![Page 1: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/1.jpg)
장주욱 1
Chapter 2: Application Layer
![Page 2: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/2.jpg)
장주욱 2
주요 내용
❒ 클라이언트/서버❒ 서비스모델
❒ 응용계층 프로토콜
(application layer protocols)
❒ http❒ ftp❒ smtp❒ pop ❒ dns❒ 소켓프로그래밍
![Page 3: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/3.jpg)
장주욱 3
응용계층
❒ 분산응용에서의통신
사용자공간
메시지교환
예) 이메일, 웹, 파일전송❒ 응용계층프로토콜
❍ 응용간교환되는메시지와그에따른행동규정
❍ 트랜스포트계층(TCP,UDP)등하위계층의서비스이용
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
![Page 4: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/4.jpg)
장주욱 4
용어 정의
❒ 프로세스( process): 호스트에서작동중인
프로그램
❒ Interprocesscommunication :같은호스트내의프로세스간통신
❒ 다른호스트에있는프로세스들: 응용계층프로토콜을통해메시지교환
❒ 사용자에이전트: 사용자와네트워크응용간의인터페이스
❍ 웹(응용) –브라우저(에이전트)
❍ E-메일: 메일리더❍ 비디오스트리밍: 미디어플레이어
![Page 5: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/5.jpg)
장주욱 5
클라이언트-서버
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
클라이언트:❒ 서버에접속시도
❒ 서버에게서비스요청
❒ 웹: 브라우저가클라이언트서버:❒ 요청받은서비스제공
❒ 예) 웹서버가요청받은웹페이지제공
요청
응답
![Page 6: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/6.jpg)
장주욱 6
응용계층프로토콜
API: application programming interface
❒ 응용계층-트랜스포트계층인터페이스
❒ 소켓(socket): 인터넷API
❍ 두프로세스가소켓을통해메시지교환
Q: 어떻게다른호스트에있는 프로세스를구분하는가?
❍ IP address❍ port number
… lots more on this later.
![Page 7: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/7.jpg)
장주욱 7
응용이요구하는트랜스포트서비스는?
신뢰성(reliability)❒ 오디오/비디오등은약간의데이터손실감수
❒ 화일전송, E-메일등은신뢰성요구
지연(Delay)❒ 오디오응용등은최저
지연요구대역폭(Bandwidth)❒ 멀티미디어응용은일정대역폭요구
❒ 다른응용은탄력적(elastic)
![Page 8: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/8.jpg)
장주욱 8
주요 응용의 트랜스 포트서비스 요구
응용응용응용응용
file transfere-mail
Web documentsreal-time audio/video
stored audio/videointeractive games
financial apps
신뢰성신뢰성신뢰성신뢰성
no lossno lossloss-tolerantloss-tolerant
loss-tolerantloss-tolerantno loss
대역폭대역폭대역폭대역폭
elasticelasticelasticaudio: 5Kb-1Mbvideo:10Kb-5Mbsame as above few Kbps upelastic
최저최저최저최저지연지연지연지연요구요구요구요구
nononoyes, 100’s msec
yes, few secsyes, 100’s msecyes and no
![Page 9: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/9.jpg)
장주욱 9
트랜스포트프로토콜이제공하는서비스
TCP :❒ 연결형(connection-
oriented) ❒ 신뢰성(reliable
transport)❒ 흐름제어(flow control) ❒ 정체제어(congestion
control)❒ 제공안함:대역폭, 최저지연보장
UDP:❒ 신뢰성보장안함
❒ 비연결형
Q: UDP의존재이유는?다중화(응용간)
![Page 10: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/10.jpg)
장주욱 10
인터넷 응용: 프로토콜및 사용하는 트랜스포트프로토콜
응용응용응용응용
e-mailremote terminal access
Web file transfer
streaming multimedia
remote file serverInternet telephony
응용계층응용계층응용계층응용계층프로토콜프로토콜프로토콜프로토콜
smtp [RFC 821]telnet [RFC 854]http [RFC 2068]ftp [RFC 959]proprietary(e.g. RealNetworks)NSFproprietary(e.g., Vocaltec)
사용하는사용하는사용하는사용하는트랜스포트트랜스포트트랜스포트트랜스포트프로토콜프로토콜프로토콜프로토콜
TCPTCPTCPTCPTCP or UDP
TCP or UDPtypically UDP
![Page 11: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/11.jpg)
장주욱 11
웹관련용어
❒ 웹페이지(Web page):베이스 HTML 페이지 + 오브젝트들
❒ URL로지정하는오브젝트(object)
❒ URL: 호스트이름 /패스
❒ 웹브라우저(사용자에이전트):
❍ MS Internet Explorer❍ Netscape Communicator
❒ 웹서버:❍ 아파치
❍ MS Internet Information Server
www.someSchool.edu/someDept/pic.gif
![Page 12: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/12.jpg)
장주욱 12
웹: http 프로토콜
http: hypertext transfer protocol
❒ client/server model❒ http1.0: RFC 1945❒ http1.1: RFC 2068
PC runningExplorer
Server running
NCSA Webserver
Mac runningNavigator
http request
http request
http response
http response
![Page 13: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/13.jpg)
장주욱 13
http
http: TCP 이용❒ 클라이언트가서버로
TCP (80 포트) 연결시도(소켓을만듦)
❒ 서버가연결요청을수락
❒ http 메시지교환❒ TCP 연결종료
http 는 “stateless”❒ 클라이언트의과거요청을기록하지않음
❒ Cf. 쿠키(cookies)
![Page 14: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/14.jpg)
장주욱 14
http 예사용자입력 URL
www.someSchool.edu/someDepartment/home.index
1a. http client initiates TCP connection to http server (process) at www.someSchool.edu. Port 80 is default for http server.
2. http client sends http request message (containing URL) into TCP connection socket
1b. http server at host www.someSchool.edu waiting for TCP connection at port 80. “accepts” connection, notifying client
3. http server receives request message, forms response message containing requested object (someDepartment/home.index), sends message into socket
time
(contains text, references to 10
jpeg images)
![Page 15: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/15.jpg)
장주욱 15
http 예(계속)
5. http client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects
6. Steps 1-5 repeated for each of 10 jpeg objects
4. http server closes TCP connection.
time
![Page 16: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/16.jpg)
장주욱 16
HTTP/1.0 과 HTTP/1.1 비교
HTTP/1.0❒ server parses request,
responds, and closes TCP connection
❒ 각오브젝트를가져오는2 RTT 소요
❒ 각 오브젝트마다 slow start O/H
HTTP/1.1❒ 하나의 TCP 연결로모든오브젝트를가져옴
❒ 베이스 HTML을받는즉시참조된모든오브젝트를가져옴(pipelining).
❒ 적은 수의 RTT와 slow start O/H
❒ 패킷수감소(여러개의연결시도등을다중화)
But most 1.0 browsers useparallel TCP connections.
![Page 17: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/17.jpg)
장주욱 17
http 메시지형식: request
❒ two types of http messages: request, response❒ http request message: ASCII
GET /somedir/page.html HTTP/1.0 User-agent: Mozilla/4.0 Accept: text/html, image/gif,image/jpeg Accept-language:fr
(extra carriage return, line feed)
request line(GET, POST,
HEAD commands)
headerlines
Carriage return, line feed
indicates end of message
![Page 18: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/18.jpg)
장주욱 18
http request 메세지: general format
![Page 19: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/19.jpg)
장주욱 19
http message format: respone
HTTP/1.0 200 OK Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998 …... Content-Length: 6821 Content-Type: text/html
data data data data data ...
status line(protocol
status codestatus phrase)
headerlines
data, e.g., requestedhtml file
![Page 20: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/20.jpg)
장주욱 20
http response status codes
200 OK❍ request succeeded, requested object later in this message
301 Moved Permanently❍ requested object moved, new location specified later in
this message (Location:)400 Bad Request
❍ request message not understood by server404 Not Found
❍ requested document not found on this server505 HTTP Version Not Supported
In first line in server->client response message.A few sample codes:
![Page 21: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/21.jpg)
장주욱 21
Trying out http (client side) for yourself
1. Telnet to your favorite Web server:Opens TCP connection to port 80(default http server port) at www.eurecom.fr.Anything typed in sent to port 80 at www.eurecom.fr
telnet www.eurecom.fr 80
2. Type in a GET http request:GET /~ross/index.html HTTP/1.0 By typing this in (hit carriage
return twice), you sendthis minimal (but complete) GET request to http server
3. Look at response message sent by http server!
![Page 22: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/22.jpg)
장주욱 22
사용자-서버: 인증(authentication)
❒ stateless: request할때마다인증필요( 브라우저가캐싱가능)
❒ authorization: 대개 name, password
❍ authorization: header line in request
❍ authorization 이없으면, 서버는접근거절하고
WWW authenticate:
을보낸다.
client serverusual http request msg401: authorization req.WWW authenticate:
usual http request msg+ Authorization:line
usual http response msg
usual http request msg+ Authorization:line
usual http response msg time
![Page 23: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/23.jpg)
장주욱 23
사용자-서버: 쿠키(cookies)
❒ 서버가사용자에게쿠키를보냄Set-cookie: 1678453
❒ 클라이언트다음번request할때쿠키제시cookie: 1678453
❒ 서버는저장된쿠키와비교하여
❍ 인증
❍ 사용자기호, 이전선택등을파악하여개인화된서비스제공
client serverusual http request msgusual http response +Set-cookie: #
usual http request msgcookie: #
usual http response msg
usual http request msgcookie: #
usual http response msg
쿠키에따른처리
쿠키에따른처리
![Page 24: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/24.jpg)
장주욱 24
사용자-서버: conditional GET
❒ 사용자가최신내용을캐쉬하고있으면보내지
않음
❒ 클라이언트: 캐쉬한시간표시If-modified-since: <date>
❒ 서버: 변하지않았으면보내지않음: HTTP/1.0 304 Not Modified
클라이언트 서버
http request msgIf-modified-since:
<date>
http responseHTTP/1.0
304 Not Modified
오브젝트불변
http request msgIf-modified-since:
<date>
http responseHTTP/1.1 200 OK
…
<data>
오브젝트변함
![Page 25: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/25.jpg)
장주욱 25
웹캐쉬 (프록시 서버)
❒ 사용자는브라우저설정: 웹캐시를통해웹접속하도록
❒ 클라이언트는모든all http request를웹캐시에보냄
❍ Hit 시에는웹캐쉬가직접
❍ Miss 시에는원래서버에접속후
원래 서버대신에 사용자의 요청을 서비스
클라이언트
프록시서버
클라이언트
http request
http request
http response
http response
http request
http response
http requesthttp response
원래서버
원래서버
![Page 26: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/26.jpg)
장주욱 26
웹캐싱을하는이유?
❒ 응답시간단축: 캐쉬가가까이있을때
❒ 원거리서버로의트래픽
감소❍ 외부로나가는링크가보통병목
원래서버
인터넷
기관네트워크 10 Mbps LAN
1.5 Mbps 억세스 링크
캐쉬
![Page 27: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/27.jpg)
장주욱 27
ftp: 파일전송프로토콜
❒ 원격 서버로의파일송수신
❒ 클라이언트/서버모델❒ ftp: RFC 959❒ ftp server: port 21
파일 전송 FTP서버
FTP사용자인터페이스
FTP클라이언트
지역 파일시스템
원격 파일시스템
사용자
![Page 28: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/28.jpg)
장주욱 28
ftp: 제어, 데이터연결의분리
❒ 클라이언트는서버의 TCP 포트 21번으로접속시도
❒ 두개의TCP 연결을연다:❍ 제어: 명령과응답을교환
“out of band control”
❍ 데이타: 파일송수신❒ ftp 서버는 “state”를유지 : 현재의디렉토리, 이전인증등
FTP클라이언트
FTP서버
TCP 제어 연결port 21
TCP 데이터 연결port 20
![Page 29: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/29.jpg)
장주욱 29
ftp 명령과 응답
명령(예):❒ 제어채널을통해 ASCII로❒ USER username
❒ PASS password
❒ LIST return list of file in current directory
❒ RETR filename retrieves (gets) file
❒ STOR filename stores (puts) file onto remote host
응답코드(예)❒ status code and phrase (as
in http)❒ 331 Username OK,
password required
❒ 125 data connection already open; transfer starting
❒ 425 Can’t open data connection
❒ 452 Error writing file
![Page 30: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/30.jpg)
장주욱 30
E-메일
세가지요소:❒ user agents ❒ mail servers ❒ simple mail transfer
protocol: smtp
사용자에이전트
❒ 메일리더
❒ 메일메시지, 제작, 편집, 읽기❒ 예) Eudora, Outlook, elm,
Netscape Messenger❒ 들어오고나가는메시지는서버에저장
사용자메일박스
나가는메시지 큐
mailserver
useragent
useragent
useragent
mailserver
useragent
useragent
mailserver
useragent
SMTP
SMTP
SMTP
![Page 31: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/31.jpg)
장주욱 31
Electronic Mail: mail servers
Mail Servers❒ mailbox contains incoming
messages (yet to be read) for user
❒ message queue of outgoing (to be sent) mail messages
❒ smtp protocol between mail servers to send email messages
❍ client: sending mail server
❍ “server”: receiving mail server
mailserver
useragent
useragent
useragent
mailserver
useragent
useragent
mailserver
useragent
SMTP
SMTP
SMTP
![Page 32: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/32.jpg)
장주욱 32
Electronic Mail: smtp [RFC 821]
❒ uses tcp to reliably transfer email msg from client to server, port 25
❒ direct transfer: sending server to receiving server❒ three phases of transfer
❍ handshaking (greeting)❍ transfer of messages❍ closure
❒ command/response interaction❍ commands: ASCII text❍ response: status code and phrase
❒ messages must be in 7-bit ASCII
![Page 33: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/33.jpg)
장주욱 33
Sample smtp interactionS: 220 hamburger.edu C: HELO crepes.fr S: 250 Hello crepes.fr, pleased to meet you C: MAIL FROM: <[email protected]> S: 250 [email protected]... Sender ok C: RCPT TO: <[email protected]> S: 250 [email protected] ... Recipient ok C: DATA S: 354 Enter mail, end with "." on a line by itself C: Do you like ketchup? C: How about pickles? C: . S: 250 Message accepted for delivery C: QUIT S: 221 hamburger.edu closing connection
![Page 34: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/34.jpg)
장주욱 34
try smtp interaction for yourself:
❒ telnet servername 25
❒ see 220 reply from server❒ enter HELO, MAIL FROM, RCPT TO, DATA, QUIT
commandsabove lets you send email without using email client
(reader)
![Page 35: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/35.jpg)
장주욱 35
smtp: final words
❒ smtp uses persistent connections
❒ smtp requires that message (header & body) be in 7-bit ascii
❒ certain character strings are not permitted in message (e.g., CRLF.CRLF). Thus message has to be encoded (usually into either base-64 or quoted printable)
❒ smtp server uses CRLF.CRLF to determine end of message
Comparison with http❒ http: pull❒ email: push
❒ both have ASCII command/response interaction, status codes
❒ http: each object is encapsulated in its own response message
❒ smtp: multiple objects message sent in a multipart message
![Page 36: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/36.jpg)
장주욱 36
Mail message format
smtp: protocol for exchanging email msgs
RFC 822: standard for text message format:
❒ header lines, e.g.,❍ To:❍ From:❍ Subject:different from smtp
commands!❒ body
❍ the “message”, ASCII characters only
header
body
blankline
![Page 37: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/37.jpg)
장주욱 37
Message format: multimedia extensions
❒ MIME: multimedia mail extension, RFC 2045, 2056❒ additional lines in msg header declare MIME content
type
From: [email protected] To: [email protected] Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg
base64 encoded data ..... ......................... ......base64 encoded data
multimedia datatype, subtype,
parameter declaration
method usedto encode data
MIME version
encoded data
![Page 38: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/38.jpg)
장주욱 38
MIME typesContent-Type: type/subtype; parameters
Text❒ example subtypes: plain,
html
Image❒ example subtypes: jpeg,
gif
Audio❒ exampe subtypes: basic
(8-bit mu-law encoded), 32kadpcm (32 kbps coding)
Video❒ example subtypes: mpeg,
quicktime
Application❒ other data that must be
processed by reader before “viewable”
❒ example subtypes: msword, octet-stream
![Page 39: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/39.jpg)
장주욱 39
Multipart TypeFrom: [email protected] To: [email protected] Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=98766789
--98766789Content-Transfer-Encoding: quoted-printableContent-Type: text/plain
Dear Bob, Please find a picture of a crepe.--98766789Content-Transfer-Encoding: base64Content-Type: image/jpeg
base64 encoded data ..... ......................... ......base64 encoded data --98766789--
![Page 40: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/40.jpg)
장주욱 40
Mail access protocols
❒ SMTP: delivery/storage to receiver’s server❒ Mail access protocol: retrieval from server
❍ POP: Post Office Protocol [RFC 1939]• authorization (agent <-->server) and download
❍ IMAP: Internet Mail Access Protocol [RFC 1730]• more features (more complex)• manipulation of stored msgs on server
❍ HTTP: Hotmail , Yahoo! Mail, etc.
useragent
sender’s mail server
useragent
SMTP SMTP POP3 orIMAP
receiver’s mail server
![Page 41: Chapter 2: Application Layereeca2.sogang.ac.kr/class/2002_2/internetnetwork/cyber... · 2002-11-14 · 장주욱 2 주요내용 클라이언트/서버 서비스모델 응용계층프로토콜](https://reader033.vdocuments.pub/reader033/viewer/2022060323/5f0da7c07e708231d43b6dda/html5/thumbnails/41.jpg)
장주욱 41
POP3 protocol
authorization phase❒ client commands:
❍ user: declare username❍ pass: password
❒ server responses❍ +OK
❍ -ERR
transaction phase, client:❒ list: list message numbers❒ retr: retrieve message by
number❒ dele: delete❒ quit
C: list S: 1 498 S: 2 912 S: . C: retr 1 S: <message 1 contents>S: . C: dele 1 C: retr 2 S: <message 1 contents>S: . C: dele 2 C: quit S: +OK POP3 server signing off
S: +OK POP3 server ready C: user alice S: +OK C: pass hungry S: +OK user successfully logged on