IT 424 Networks2 IT 424 Networks2 Ack.: Slides are adapted from the slides of the book: “Computer...
-
Upload
richard-bradley -
Category
Documents
-
view
217 -
download
1
Transcript of IT 424 Networks2 IT 424 Networks2 Ack.: Slides are adapted from the slides of the book: “Computer...
IT 424
Networks2IT 424
Networks2
Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross
Chapter 2: Application Layer
Chapter 2: Application Layer
Part 2: Client Server
Part 2: Client Server
- FTP & Email
- FTP & Email
File
Trans
fer P
roto
col (
FTP)
Electro
nic Mail
Applic
ation
Simple Mail Transfer Protocol
Mail Access Protocols (POP3, IMAP)
Overview
2
Learning Outcomes
1 To describe the FTP protocol
2To differentiate between in-band and out of band protocols
3To explain the different components and protocols incorporated in e-mail application
4 To define the role of the SMTP Protocol
5To describe the main architecture of the email application
6To compare between push and pull protocols and define the role of POP3 & IMAP Protocols3
File
Trans
fer P
roto
col (
FTP)
Electro
nic Mail
Applic
ation
Simple Mail Transfer Protocol
Mail Access Protocols (POP3, IMAP)
Overview
4
Transfer file to/from remote host Client/server model
Client: side that initiates transfer (either to/from remote) Server: remote host
FTP: RFC 959 FTP server: port 21
FTP: The File Transfer Protocol
file transferFTP
server
FTPuser
interface
FTPclient
local filesystem
remote filesystem
user at host
File Transfer Protocol (FTP)
5
FTP: Separate control, Data connections
FTP client contacts FTP server at port 21, using TCP
Client authorized over control connection
Client browses remote directory, sends commands over control connection
When server receives file transfer command, server opens 2nd TCP data connection (for file) to client Server opens another TCP
data connection to transfer another file
Control connection: “out of band”
After transferring one file, server closes data connection
FTP server maintains “state”: current directory, earlier authentication
File Transfer Protocol – How FTP Works?
FTPclient
FTPserver
TCP control connection,server port 21
TCP data connection,server port 20
6
FTP Commands, Responses
Sample commands:Sent as ASCII text over control channel
USER usernamePASS passwordLIST: return list of file in current directoryRETR filename: retrieves (gets) fileSTOR filename: stores (puts) file onto remote host
Sample return codesStatus code and phrase (as in HTTP)
331 Username OK, password required125 data connection already open; transfer starting425 Can’t open data connection452 Error writing file
File Transfer Protocol - Commands, Responses
7
File
Trans
fer P
roto
col (
FTP)
Electro
nic Mail
Applic
ation
Simple Mail Transfer Protocol
Mail Access Protocols (POP3, IMAP)
Overview
8
Three major components: User agents Mail servers Simple mail transfer protocol: SMTP
1. User AgentA.K.A. “Mail reader”Composing, editing, reading mail messagesE.G., Outlook, thunderbird, iphone mail clientOutgoing, incoming messages stored on server
Electronic Mail
Electronic Mail Application
user mailbox
outgoing message queue
mailserver
mailserver
mailserver
SMTP
SMTP
SMTP
useragent
useragent
useragent
9
2. Mail servers: which consists of:Mailbox contains incoming messages for userMessage queue of outgoing (to be sent) mail messages
3. SMTP protocol between mail servers to send email messages Client: sending mail server “Server”: receiving mail server
Electronic Mail
Electronic Mail Application
mailserver
mailserver
mailserver
SMTP
SMTP
SMTP
useragent
useragent
useragent
useragent
useragent
10
File
Trans
fer P
roto
col (
FTP)
Electro
nic Mail
Applic
ation
Simple Mail Transfer Protocol
Mail Access Protocols (POP3, IMAP)
Overview
11
Electronic Mail: SMTP [RFC 2821]
Uses TCP to reliably transfer email message from client to server, port 25 Direct transfer: sending server to receiving server
Three phases of transfer:1. Handshaking (greeting)2. Transfer of messages3. Closure
Command/response interaction (like HTTP, FTP) Commands: ASCII text Response: status code and phrase
Messages (header + body) must be in 7-bit ASCII
Simple Mail Transfer Protocol
12
Scenario: Alice Sends Message To Bob
1) Alice uses UA to compose message “to” [email protected]
2) Alice’s UA sends message to her mail server; message placed in message queue
3) client side of SMTP opens TCP connection with Bob’s mail server
Simple Mail Transfer Protocol
4) SMTP client sends Alice’s message over the TCP connection
5) Bob’s mail server places the message in Bob’s mailbox
6) Bob invokes his user agent to read message
useragent
mailserver
mailserver
1
2 3 4
5
6
Alice’s mail server Bob’s mail server
useragent
13
S: 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
Sample SMTP Interaction
Simple Mail Transfer Protocol - Interaction
14
SMTP: protocol for exchanging email msgsRFC 822: standard for text message format:
1.Header lines:Some required and optional keywords followed by collen, e.g.To:From:Subject:
different from SMTP MAIL FROM, RCPT TO: commands!
2.Body: the “message” ASCII characters only
Mail Message Format
Simple Mail Transfer Protocol – Mail Message Format
header
body
blankline
15
HTTP and SMTP Similarities and Differences
Similarity DifferencesBoth have ASCII command/response interaction, status codes
HTTP: pull SMTP: push
SMTP requires the body to be encoded into 7-bit ASCII.
HTTP does not impose this restriction
SMTP uses persistent connections like the case in persistent HTTP.
HTTP: each object encapsulated in its own response message
SMTP: multiple objects sent in multipart message
SMTP server uses CRLF.CRLF to determine end of message
16
File
Trans
fer P
roto
col (
FTP)
Electro
nic Mail
Applic
ation
Simple Mail Transfer Protocol
Mail Access Protocols (POP3, IMAP)
Overview
17
Mail Access Protocols
Protocol to transfer email message from client to server ,delivery/storage to receiver’s server SMTP
Mail Access Protocol: retrieval from server POP: Post Office Protocol [RFC 1939]: authorization, download IMAP: Internet Mail Access Protocol [RFC 1730]: more features, including
manipulation of stored messages on server HTTP: gmail, Hotmail, Yahoo! Mail, etc.
sender’s mail server
SMTP SMTPmail access
protocol
receiver’s mail server
(e.g., POP, IMAP)
useragent
useragent
Mail Access Protocols
18
POP3 Protocol
POP3 progresses through three phases:
1. Authorization,2. Transaction3. Update
Mail Access Protocols - POP3
19
POP3 Protocol
1- Authorization phase
Client commands: user username pass password
Server responses +Ok -Err
S: +OK POP3 server ready C: user bob S: +OK C: pass hungry S: +OK user successfully logged on
Mail Access Protocols - POP3
20
POP3 Protocol
2- Transaction phase,
Client commands: List: list message numbers Retr: retrieve message by
number Dele: delete Quit
Server responses: +Ok -Err
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 2 contents> S: . C: dele 2 C: quit S: +OK POP3 server signing off
Mail Access Protocols - POP3
21
POP3 (more)
3- Update Phase:
After processing the “quit” command, the POP3 server enters the phase and remove messages 1 and 2 from the mailbox
Mail Access Protocols - POP3
22
POP3 (more)
POP3 Configuration Modes:A user agernt using POP3 can be configured (by the user) to:
1-“download and delete” mode: Like in the Previous example, Bob cannot re-read e-mail if he changes client
2- “download-and-keep”mode : Keeps copies of messages on different clients
POP3 is stateless across sessions
POP3 does not provide any means for a user to create remote folders and assign messages to folders.
Mail Access Protocols - POP3
23
IMAP
IMAP is a mail access protocol. It has many more features than POP3, but it is also significantly more complex.
Keeps all messages in one place: at server
Allows user to organize messages in folders Keeps user state across sessions:
Names of folders and mappings between message IDs and folder name
Mail Access Protocols - IMAP
24
Web-Based E-mail
Hotmail, Yahoo, Google.
The user agent is an ordinary Web browser
The user communicates with its remote mailbox via HTTP
When a sender wants to send email message, the message is sent from browser to mail server over HTTP rather than SMTP.
When a receiver wants to access a message in his mail box, the email message is sent from server to browser using HTTP protocol rather than POP3 or IMAP
However, communications between mail servers use SMTP
Mail Access Protocols - IMAP
25
Conclusion
Conclusion
FTP differs from other client-server applications in that it establishes two connections between the hosts:
One connection is used for data transfer, the other for control information (commands and responses).
Separation of commands and data transfer makes FTP more efficient.
E-mail architecture consists of three major components:1. User Agent2. Mail servers3. Protocols
Message Transfer Protocol: SMTP Message Access Protocol: POP and IMAP
26
References
References
Computer Networking: A Top-Down Approach Featuring the Internet by James Kurose and Keith Ross, Addison Wesley, 2012 (chapter 2 )
File Transfer Protocol(RFC959)
Simple Mail Transfer Protocol (RFC2821)
27