Application Layer
Application Layer
Architectures
Xiaowei Yang
xwy@cs.duke.edu
The Internet Architecture
Application layer
Network layer
Link layer
Physical layer
Applications
• Examples
– HTTP and HTML
– SMTP and RFC 2822 (Internet Text Messages), and Multipurpose
Internet Mail Extensions (MIME)
– “Subject: Hello!”
• Body body
– The text message
– No particular structure
or meaning
Limitation: Sending Non-Text Data
• E-mail body is 7-bit U.S. ASCII
– What about non-English text?
– What about binary files (e.g., images and executables)?
==== end
– 1st:: uuencode –m cat.txt < lecture.ppt; -m: MIME Base64
--00151759359af49a3e04a1271622
Content-Type: text/plain; charset=ISO-8859-1
Cheers,
Xiaowei
Ex: Email Msg
using MIME --00151759359af49a3e04a1271622
Content-Type: image/jpeg; name="Neo-Run.jpg"
Content-Disposition: attachment; filename="Neo-Run.jpg"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_gmmpmaoi0
• Mail servers
– Always on and always accessible
– Transferring e-mail to and from other servers
• User agents
– Sometimes on and sometimes accessible
– Intuitive interface for the user
SMTP Store-and-Forward Protocol
user user
agent agent
mail server mail server
• Client-server protocol
– Client is the sending mail server
– Server is the receiving mail server
• Reliable data transfer
– Built on top of TCP (on port 25)
• Push protocol
– Sending server pushes the file to the receiving server
– … rather than waiting for the receiver to request it
Simple Mail Transfer Protocol (Cont.)
• Command/response interaction
– Commands: ASCII text
– Response: three-digit status code and phrase
• Synchronous
– Sender awaits response from a command
– … before issuing the next command
– Though pipelining of commands was added later
1 mail
mail
server user
user server
2 agent
agent 3 6
4 5
Sample SMTP interaction
• Server-side searches
– Search on server before downloading messages
Web-Based E-Mail
• User agent is an ordinary Web browser
– User communicates with server via HTTP
– E.g., Gmail, Yahoo mail, and Hotmail
• Reading e-mail
– Web pages display the contents of folders
– … and allow users to download and view messages
– “GET” request to retrieve the various Web pages
• Sending e-mail
– User types the text into a form and submits to the server
– “POST” request to upload data to the server
– Server uses SMTP to deliver message to other servers
• Easy to send anonymous e-mail (e.g., spam)
Conclusion
• Application-layer protocols
– Applications vs. application-layer protocols
– Tailoring the protocol to the application
• Electronic mail
– E-mail messages, and multipurpose Internet Mail extensions
(MIME)
– E-mail addresses, and role of DNS
– E-mail servers and user agents