1 / 40

Chapter 2: Application layer

2.1 Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS. 2.6 P2P file sharing 2.7 Socket programming with TCP 2.8 Socket programming with UDP 2.9 Building a Web server. Chapter 2: Application layer. transfer file to/from remote host

Download Presentation

Chapter 2: Application layer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 2.1 Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P file sharing 2.7 Socket programming with TCP 2.8 Socket programming with UDP 2.9 Building a Web server Chapter 2: Application layer 2: Application Layer

  2. 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 user interface FTP client FTP server local file system FTP: the file transfer protocol file transfer user at host remote file system 2: Application Layer

  3. FTP client contacts FTP server at port 21, specifying TCP as transport protocol Client obtains authorization over control connection Client browses remote directory by sending commands over control connection. When server receives a command for a file transfer, the server opens a TCP data connection to client After transferring one file, server closes connection. TCP control connection port 21 TCP data connection port 20 FTP client FTP server FTP: separate control, data connections • Server opens a second TCP data connection to transfer another file. • Control connection: “out of band” • FTP server maintains “state”: current directory, earlier authentication 2: Application Layer

  4. Sample commands: sent as ASCII text over control channel USER username PASS password LISTreturn list of file in current directory RETR filenameretrieves (gets) file STOR filenamestores (puts) file onto remote host Sample return codes 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 FTP commands, responses 2: Application Layer

  5. 2.1 Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P file sharing 2.7 Socket programming with TCP 2.8 Socket programming with UDP 2.9 Building a Web server Chapter 2: Application layer 2: Application Layer

  6. SMTP SMTP 2: Application Layer

  7. System components: UA and MTA SMTP SMTP SMTP 2: Application Layer

  8. Mail gateway 2: Application Layer

  9. Format of an message 2: Application Layer

  10. Email Address 2: Application Layer

  11. Mail delivery (sender) 2: Application Layer

  12. Mail delivery (receiver) 2: Application Layer

  13. Alias 2: Application Layer

  14. Email System 2: Application Layer

  15. MTA 2: Application Layer

  16. Connection establishment 2: Application Layer

  17. Message Transfer 2: Application Layer

  18. Connection termination 2: Application Layer

  19. Mail delivery 2: Application Layer

  20. Email delivery procedures 2: Application Layer

  21. Mail Access Protocols • The mail message is delivered to a server that is always running.(stage 2) • But people don’t always turn on their computers. So an organization operates a mail server which store mail messages in the mailboxes of users. • Users later retrieve their messages from the mailboxes and read them by using the mail access protocols such as POP3 or IMAP4. 2: Application Layer

  22. POP3 2: Application Layer

  23. IMAP4 • POP3 is simple but is limited in functionality. • POP3 is deficient in that it doesn’t allow the user to organize mail on the server; the user can’t have different folder on the server. • Internet Mail Access Protocol v4(IMAP4) is similar to POP3, but has more features. 2: Application Layer

  24. Web-based Mail • Mail transfer from a sender’s browser and sending mail server is done through HTTP. • The transfer of the message from the sending mail server to receiving mail server is still through SMTP. • The message from the receiving mail server to the receiver’s browser is done through HTTP. So the mail messages are transferred from the server to the browser in HTML format. 2: Application Layer

  25. Multipurpose Internet Mail Extension(MIME) • The original SMTP can send messages only in 7-bit ASCII format. MIME is a supplementary protocol that allows non-ASCII data to be sent through SMTP. 2: Application Layer

  26. MIME header • MIME defines five headers that can be added to the original SMTP header section to define the transformation parameters. 2: Application Layer

  27. 2.1 Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P file sharing 2.7 Socket programming with TCP 2.8 Socket programming with UDP 2.9 Building a Web server Chapter 2: Application layer 2: Application Layer

  28. People: many identifiers: SSN, name, passport # Internet hosts, routers: IP address (32 bit) - used for addressing datagrams “name”, e.g., ww.yahoo.com - used by humans Q: map between IP addresses and name ? Domain Name System: distributed database implemented in hierarchy of many name servers application-layer protocol host, routers, name servers to communicate to resolvenames (address/name translation) note: core Internet function, implemented as application-layer protocol complexity at network’s “edge” DNS: Domain Name System 2: Application Layer

  29. Why not centralize DNS? single point of failure traffic volume distant centralized database maintenance doesn’t scale! DNS services Hostname to IP address translation Host aliasing Canonical and alias names Mail server aliasing Load distribution Replicated Web servers: set of IP addresses for one canonical name DNS 2: Application Layer

  30. Root DNS Servers org DNS servers edu DNS servers com DNS servers poly.edu DNS servers umass.edu DNS servers pbs.org DNS servers yahoo.com DNS servers amazon.com DNS servers Distributed, Hierarchical Database Client wants IP for www.amazon.com; 1st approx: • Client queries a 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 2: Application Layer

  31. contacted by local name server that can not resolve name root name server: contacts authoritative name server if name mapping not known gets mapping returns mapping to local name server a Verisign, Dulles, VA c Cogent, Herndon, VA (also Los Angeles) d U Maryland College Park, MD g US DoD Vienna, VA h ARL Aberdeen, MD j Verisign, ( 11 locations) k RIPE London (also Amsterdam, Frankfurt) i Autonomica, Stockholm (plus 3 other locations) m WIDE Tokyo e NASA Mt View, CA f Internet Software C. Palo Alto, CA (and 17 other locations) b USC-ISI Marina del Rey, CA l ICANN Los Angeles, CA DNS: Root name servers 13 root name servers worldwide 2: Application Layer

  32. TLD and Authoritative Servers • Top-level domain (TLD) servers: responsible for com, org, net, edu, etc, and all top-level country domains uk, fr, ca, jp. • Network solutions maintains servers for com TLD • Educause for edu TLD • Authoritative DNS servers: organization’s DNS servers, providing authoritative hostname to IP mappings for organization’s servers (e.g., Web and mail). • Can be maintained by organization or service provider 2: Application Layer

  33. Local Name Server • Does not strictly belong to hierarchy • Each ISP (residential ISP, company, university) has one. • Also called “default name server” • When a host makes a DNS query, query is sent to its local DNS server • Acts as a proxy, forwards query into hierarchy. 2: Application Layer

  34. Host at cis.poly.edu wants IP address for gaia.cs.umass.edu local DNS server dns.poly.edu Example root DNS server 2 3 TLD DNS server 4 5 6 7 1 8 authoritative DNS server dns.cs.umass.edu requesting host cis.poly.edu gaia.cs.umass.edu 2: Application Layer

  35. root DNS server 2 3 6 7 TLD DNS server 4 local DNS server dns.poly.edu 5 1 8 authoritative DNS server dns.cs.umass.edu requesting host cis.poly.edu gaia.cs.umass.edu Recursive queries • recursive query: • puts burden of name resolution on contacted name server • heavy load? • iterated query: • contacted server replies with name of server to contact • “I don’t know this name, but ask this server” 2: Application Layer

  36. once (any) name server learns mapping, it caches mapping cache entries timeout (disappear) after some time TLD servers typically cached in local name servers Thus root name servers not often visited update/notify mechanisms under design by IETF RFC 2136 http://www.ietf.org/html.charters/dnsind-charter.html DNS: caching and updating records 2: Application Layer

  37. DNS: distributed db storing resource records (RR) Type=NS name is domain (e.g. foo.com) value is hostname of authoritative name server for this domain RR format: (name, value, type, ttl) DNS records • Type=A • name is hostname • value is IP address • Type=CNAME • name is alias name for some “canonical” (the real) name www.ibm.com is really servereast.backup2.ibm.com • value is canonical name • Type=MX • value is name of mailserver associated with name 2: Application Layer

  38. DNS protocol :queryand reply messages, both with same message format DNS protocol, messages • msg header • identification: 16 bit # for query, reply to query uses same # • flags: • query or reply • recursion desired • recursion available • reply is authoritative 2: Application Layer

  39. DNS protocol, messages Name, type fields for a query RRs in response to query records for authoritative servers additional “helpful” info that may be used 2: Application Layer

  40. Inserting records into DNS • Example: just created startup “Network Utopia” • Register name networkuptopia.com at a registrar (e.g., Network Solutions) • Need to provide registrar with names and IP addresses of your authoritative name server (primary and secondary) • Registrar inserts two RRs into the com TLD server: (networkutopia.com, dns1.networkutopia.com, NS) (dns1.networkutopia.com, 212.212.212.1, A) • Put in authoritative server Type A record for www.networkuptopia.com and Type MX record for networkutopia.com • How do people get the IP address of your Web site? 2: Application Layer

More Related