chapter 2 part b outline
play

Chapter 2 part B: outline 2.3 FTP 2.4 electronic mail SMTP, POP3, - PDF document

Chapter 2 part B: outline 2.3 FTP 2.4 electronic mail SMTP, POP3, IMAP 2.5 DNS Application Layer 2-1 FTP: the file transfer protocol file transfer FTP FTP FTP user client server interface user remote file at host local file


  1. Chapter 2 part B: outline 2.3 FTP 2.4 electronic mail � SMTP, POP3, IMAP 2.5 DNS Application Layer 2-1 FTP: the file transfer protocol file transfer FTP FTP FTP user client server interface user remote file at host local file system system � 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 Application Layer 2-2 1

  2. FTP: separate control, data connections TCP control connection, � FTP client contacts FTP server server port 21 at port 21, using TCP � client authorized over control TCP data connection, connection server port 20 FTP FTP client server � client browses remote directory, sends commands � server opens another TCP over control connection data connection to transfer � when server receives file another file transfer command, server opens 2 nd TCP data � control connection: “ out of band ” connection (for file) to client � FTP server maintains � after transferring one file, “ state ” : current directory, server closes data connection earlier authentication Application Layer 2-3 FTP commands, responses sample commands: sample return codes � sent as ASCII text over � status code and phrase (as control channel in HTTP) � USER username � 331 Username OK, password required � PASS password � 125 data � LIST return list of file in connection current directory already open; � RETR filename transfer starting retrieves (gets) file � 425 Can ’ ’ t open ’ ’ data connection � STOR filename stores (puts) file onto remote � 452 Error writing host file Application Layer 2-4 2

  3. Chapter 2 part B: outline 2.3 FTP 2.4 electronic mail � SMTP, POP3, IMAP 2.5 DNS Application Layer 2-5 Electronic mail outgoing message queue user mailbox Three major components: user agent � user agents � mail servers mail user server � simple mail transfer agent protocol: SMTP SMTP mail user server agent User Agent SMTP � a.k.a. “ mail reader ” user SMTP agent � composing, editing, reading mail server mail messages user � e.g., Outlook, Thunderbird, agent iPhone mail client user agent � outgoing, incoming messages stored on server Application Layer 2-6 3

  4. Electronic mail: mail servers mail servers: user agent � mailbox contains incoming messages for user mail user server � message queue of outgoing agent (to be sent) mail messages SMTP mail user � SMTP protocol between server agent mail servers to send email SMTP messages SMTP user � client: sending mail agent mail server server � “ server ” : receiving mail user agent server user agent Application Layer 2-7 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 � handshaking (greeting) � transfer of messages � closure � command/response interaction (like HTTP, FTP ) � commands: ASCII text � response: status code and phrase � messages must be in 7-bit ASCI Application Layer 2-8 4

  5. Scenario: Alice sends message to Bob 4) SMTP client sends Alice ’ s 1) Alice uses UA to compose message over the TCP message “ to ” connection bob@someschool.edu 5) Bob ’ s mail server places the 2) Alice ’ s UA sends message message in Bob ’ s mailbox to her mail server; message placed in message queue 6) Bob invokes his user agent to read message 3) client side of SMTP opens TCP connection with Bob ’ s mail server user user 1 mail mail agent agent server server 2 3 6 4 5 Alice ’ s mail server Bob ’ s mail server Application Layer 2-9 Sample SMTP interaction S: 220 hamburger.edu C: HELO crepes.fr S: 250 Hello crepes.fr, pleased to meet you C: MAIL FROM: <alice@crepes.fr> S: 250 alice@crepes.fr... Sender ok C: RCPT TO: <bob@hamburger.edu> S: 250 bob@hamburger.edu ... 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 Application Layer 2-10 5

  6. Try SMTP interaction for yourself: � telnet servername 25 � see 220 reply from server � enter HELO, MAIL FROM, RCPT TO, DATA, QUIT commands above lets you send email without using email client (reader) Application Layer 2-11 SMTP: final words comparison with HTTP: � SMTP uses persistent connections � HTTP: pull � SMTP requires message � SMTP: push (header & body) to be in 7-bit ASCII � both have ASCII � SMTP server uses command/response CRLF.CRLF to interaction, status codes determine end of message � HTTP: each object encapsulated in its own response msg � SMTP: multiple objects sent in multipart msg Application Layer 2-12 6

  7. Mail message format SMTP: protocol for exchanging email msgs header blank RFC 822: standard for text line message format: � header lines, e.g., � To: body � From: � Subject: different from SMTP MAIL FROM, RCPT TO: commands! � Body: the “ message ” � ASCII characters only Application Layer 2-13 Mail access protocols mail access user user protocol SMTP SMTP agent agent (e.g., POP, IMAP ) sender ’ s mail receiver ’ s mail server server � SMTP: delivery/storage to receiver ’ s server � 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 msgs on server � HTTP: gmail, Hotmail, Yahoo! Mail, etc. Application Layer 2-14 7

  8. POP3 protocol S: +OK POP3 server ready C: user bob authorization phase S: +OK C: pass hungry � client commands: S: +OK user successfully logged on � user: declare username C: list � pass: password S: 1 498 � server responses S: 2 912 � +OK S: . � -ERR C: retr 1 S: <message 1 contents> transaction phase, client: S: . � list: list message numbers C: dele 1 � retr: retrieve message by C: retr 2 number S: <message 1 contents> � dele: delete S: . � quit C: dele 2 C: quit S: +OK POP3 server signing off Application Layer 2-15 POP3 (more) and IMAP more about POP3 IMAP � previous example uses � keeps all messages in one POP3 “ download and place: at server delete ” mode � allows user to organize � Bob cannot re-read e- messages in folders mail if he changes � keeps user state across client sessions: � POP3 “ download-and- � names of folders and keep ” : copies of messages mappings between on different clients message IDs and folder � POP3 is stateless across name sessions Application Layer 2-16 8

  9. Chapter 2 part B: outline 2.3 FTP 2.6 P2P applications 2.4 electronic mail 2.7 socket programming with UDP and TCP � SMTP, POP3, IMAP 2.5 DNS Application Layer 2-17 DNS: domain name system Domain Name System: people: many identifiers: � SSN, name, passport # � distributed database implemented in hierarchy of Internet hosts, routers: many name servers � IP address (32 bit) - � application-layer protocol: hosts, used for addressing name servers communicate to datagrams resolve names (address/name � “ name ” , e.g., translation) www.yahoo.com - � note: core Internet function, used by humans implemented as application- Q: how to map between IP layer protocol address and name, and � complexity at network ’ s vice versa ? “ edge ” Application Layer 2-18 9

  10. DNS: services, structure why not centralize DNS? DNS services � single point of failure � hostname to IP address translation � traffic volume � host aliasing � distant centralized database � canonical, alias names � maintenance � mail server aliasing A: doesn ’ t scale! � load distribution � replicated Web servers: many IP addresses correspond to one name Application Layer 2-19 DNS: a distributed, hierarchical database Top-Level Root DNS Servers Domain servers … … org DNS servers edu DNS servers com DNS servers poly.edu umass.edu pbs.org yahoo.com amazon.com DNS servers DNS servers DNS servers DNS servers DNS servers Authorative DNS servers client wants IP for www.amazon.com; 1 st approx: � client queries root server to find com DNS server � client queries .com DNS server to get amazon.com DNS server � client queries amazon.com DNS server to get IP address for www.amazon.com Application Layer 2-20 10

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend