Chapter 2 Application layer r 2 1 Principles
- Slides: 36
Chapter 2: Application layer r 2. 1 Principles of network applications r 2. 2 Web and HTTP r 2. 3 FTP r 2. 4 Electronic Mail m SMTP, POP 3, IMAP r 2. 5 DNS r 2. 6 P 2 P file sharing r 2. 7 Socket programming with TCP r 2. 8 Socket programming with UDP r 2. 9 Building a Web server 2: Application Layer 1
Electronic Mail outgoing message queue user mailbox user agent Three major components: r user agents r mail servers mail server SMTP r simple mail transfer protocol: SMTP User Agent r a. k. a. “mail reader” r composing, editing, reading mail messages r e. g. , Eudora, Outlook, elm, Netscape Messenger r outgoing, incoming messages stored on server SMTP mail server user agent SMTP user agent mail server user agent 2: Application Layer 2
Electronic Mail: mail servers user agent Mail Servers r mailbox contains incoming messages for user r message queue of outgoing (to be sent) mail messages r SMTP protocol between mail servers to send email messages m client: sending mail server m “server”: receiving mail server SMTP mail server user agent SMTP user agent mail server user agent 2: Application Layer 3
Electronic Mail: SMTP [RFC 2821] r uses TCP to reliably transfer email message from client to server, port 25 r direct transfer: sending server to receiving server r three phases of transfer m handshaking (greeting) m transfer of messages m closure r command/response interaction m commands: ASCII text m response: status code and phrase r messages must be in 7 -bit ASCII 2: Application Layer 4
Scenario: Alice sends message to Bob 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 1) Alice uses UA to compose message and “to” bob@someschool. edu 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 1 user agent 2 mail server 3 mail server 4 5 6 user agent 2: Application Layer 5
Sample SMTP interaction S: C: S: C: C: C: S: 220 hamburger. edu HELO crepes. fr 250 Hello crepes. fr, pleased to meet you MAIL FROM: <alice@crepes. fr> 250 alice@crepes. fr. . . Sender ok RCPT TO: <bob@hamburger. edu> 250 bob@hamburger. edu. . . Recipient ok DATA 354 Enter mail, end with ". " on a line by itself Do you like ketchup? How about pickles? . 250 Message accepted for delivery QUIT 221 hamburger. edu closing connection 2: Application Layer 6
Try SMTP interaction for yourself: r telnet servername 25 r see 220 reply from server r enter HELO, MAIL FROM, RCPT TO, DATA, QUIT commands above lets you send email without using email client (reader) 2: Application Layer 7
SMTP: final words r SMTP uses persistent connections r SMTP requires message (header & body) to be in 7 bit ASCII r SMTP server uses CRLF to determine end of message Comparison with HTTP: r HTTP: pull r SMTP: push r both have ASCII command/response interaction, status codes r HTTP: each object encapsulated in its own response msg r SMTP: multiple objects sent in multipart msg 2: Application Layer 8
Mail message format SMTP: protocol for exchanging email msgs RFC 822: standard for text message format: r header lines, e. g. , To: m From: m Subject: different from SMTP commands! m header blank line body r body m the “message”, ASCII characters only 2: Application Layer 9
Message format: multimedia extensions r MIME: multimedia mail extension, RFC 2045, 2056 r additional lines in msg header declare MIME content type MIME version method used to encode data multimedia data type, subtype, parameter declaration encoded data From: alice@crepes. fr To: bob@hamburger. edu Subject: Picture of yummy crepe. MIME-Version: 1. 0 Content-Transfer-Encoding: base 64 Content-Type: image/jpeg base 64 encoded data. . . . . base 64 encoded data 2: Application Layer 10
Mail access protocols user agent SMTP sender’s mail server access protocol user agent receiver’s mail server r SMTP: delivery/storage to receiver’s server r Mail access protocol: retrieval from server m m m 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. 2: Application Layer 11
POP 3 protocol authorization phase r client commands: m m user: declare username pass: password r server responses m m +OK -ERR transaction phase, client: r list: list message numbers r retr: retrieve message by number r dele: delete r quit S: C: S: +OK POP 3 server ready user bob +OK pass hungry +OK user successfully logged C: S: S: S: C: C: S: list 1 498 2 912. retr 1 <message 1 contents>. dele 1 retr 2 <message 1 contents>. dele 2 quit +OK POP 3 server signing off 2: Application Layer 12 on
POP 3 (more) and IMAP More about POP 3 r Previous example uses “download and delete” mode. r Bob cannot re-read email if he changes client r “Download-and-keep”: copies of messages on different clients r POP 3 is stateless across sessions IMAP r Keep all messages in one place: the server r Allows user to organize messages in folders r IMAP keeps user state across sessions: m names of folders and mappings between message IDs and folder name 2: Application Layer 13
Chapter 2: Application layer r 2. 1 Principles of network applications r 2. 2 Web and HTTP r 2. 3 FTP r 2. 4 Electronic Mail m SMTP, POP 3, IMAP r 2. 5 DNS r 2. 6 P 2 P file sharing r 2. 7 Socket programming with TCP r 2. 8 Socket programming with UDP r 2. 9 Building a Web server 2: Application Layer 14
DNS: Domain Name System People: many identifiers: m SSN, name, passport # Internet hosts, routers: m m IP address (32 bit) used for addressing datagrams “name”, e. g. , www. yahoo. com - used by humans Q: map between IP addresses and name ? Domain Name System: r distributed database implemented in hierarchy of many name servers r application-layer protocol host, routers, name servers to communicate to resolve names (address/name translation) m note: core Internet function, implemented as application-layer protocol 2: Application Layer 15
DNS services r Hostname to IP address translation r Host aliasing m Canonical and alias names r Mail server aliasing r Load distribution m Replicated Web servers: set of IP addresses for one canonical name Why not centralize DNS? r single point of failure r traffic volume r distant centralized database r maintenance doesn’t scale! 2: Application Layer 16
Distributed, Hierarchical Database Root DNS Servers com DNS servers yahoo. com amazon. com DNS servers org DNS servers pbs. org DNS servers edu DNS servers poly. edu umass. edu DNS servers Client wants IP for www. amazon. com; 1 st approx: r Client queries a root server to find com DNS server r Client queries com DNS server to get amazon. com DNS server r Client queries amazon. com DNS server to get IP address for www. amazon. com 2: Application Layer 17
DNS: Root name servers r contacted by local name server that can not resolve name r root name server: m m m 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 k RIPE London (also Amsterdam, g US Do. D Vienna, VA Frankfurt) Stockholm (plus 3 i Autonomica, h ARL Aberdeen, MD other locations) j Verisign, ( 11 locations) m WIDE Tokyo e NASA Mt View, CA f Internet Software C. Palo Alto, CA (and 17 other locations) 13 root name servers worldwide b USC-ISI Marina del Rey, CA l ICANN Los Angeles, CA 2: Application Layer 18
TLD and Authoritative Servers r Top-level domain (TLD) servers: responsible for com, org, net, edu, etc, and all top-level country domains uk, fr, ca, jp. m Verisign maintains servers for com TLD m Educause for edu TLD r Authoritative DNS servers: organization’s DNS servers, providing authoritative hostname to IP mappings for organization’s servers (e. g. , Web and mail). m Can be maintained by organization or service provider 2: Application Layer 19
Local Name Server r Does not strictly belong to hierarchy r Each ISP (residential ISP, company, university) has one. m Also called “default name server” r When a host makes a DNS query, query is sent to its local DNS server m Acts as a proxy, forwards query into hierarchy. 2: Application Layer 20
Example root DNS server 2 r Host at cis. poly. edu wants IP address for gaia. cs. umass. edu 3 4 TLD DNS server 5 local DNS server dns. poly. edu 1 8 requesting host 7 6 authoritative DNS server dns. cs. umass. edu cis. poly. edu gaia. cs. umass. edu 2: Application Layer 21
Recursive queries recursive query: 2 r puts burden of name resolution on contacted name server r heavy load? iterated query: r contacted server replies with name of server to contact r “I don’t know this name, but ask this server” root DNS server 3 7 local DNS server dns. poly. edu 1 6 TLD DNS serve 5 4 8 requesting host authoritative DNS server dns. cs. umass. edu cis. poly. edu gaia. cs. umass. edu 2: Application Layer 22
DNS: caching and updating records r once (any) name server learns mapping, it caches mapping m cache entries timeout (disappear) after some time m TLD servers typically cached in local name servers • Thus root name servers not often visited r update/notify mechanisms under design by IETF m RFC 2136 m http: //www. ietf. org/html. charters/dnsind-charter. html 2: Application Layer 23
DNS records DNS: distributed db storing resource records (RR) RR format: (name, value, type, ttl) r Type=A m name is hostname m value is IP address r Type=CNAME m name is alias name for some “canonical” (the real) name www. ibm. com is really r Type=NS servereast. backup 2. ibm. com m name is domain (e. g. m value is canonical name foo. com) m value is IP address of r Type=MX authoritative name server m value is name of mailserver for this domain associated with name 2: Application Layer 24
DNS protocol, messages DNS protocol : query and reply messages, both with same message format msg header r identification: 16 bit # for query, reply to query uses same # r flags: m query or reply m recursion desired m recursion available m reply is authoritative 2: Application Layer 25
DNS protocol, messages Name, type fields for a query RRs in reponse to query records for authoritative servers additional “helpful” info that may be used 2: Application Layer 26
Chapter 2: Application layer r 2. 1 Principles of network applications m m app architectures app requirements r 2. 2 Web and HTTP r 2. 4 Electronic Mail m SMTP, POP 3, IMAP r 2. 5 DNS r 2. 6 P 2 P file sharing r 2. 7 Socket programming with TCP r 2. 8 Socket programming with UDP r 2. 9 Building a Web server 2: Application Layer 27
P 2 P file sharing Example r Alice runs P 2 P client application on her notebook computer r Intermittently connects to Internet; gets new IP address for each connection r Asks for “Hey Jude” r Application displays other peers that have copy of Hey Jude. r Alice chooses one of the peers, Bob. r File is copied from Bob’s PC to Alice’s notebook: HTTP r While Alice downloads, other users uploading from Alice. r Alice’s peer is both a Web client and a transient Web server. All peers are servers = highly scalable! 2: Application Layer 28
P 2 P: centralized directory original “Napster” design 1) when peer connects, it informs central server: m m Bob centralized directory server 1 peers IP address content 2) Alice queries for “Hey Jude” 3) Alice requests file from Bob 1 3 1 2 1 Alice 2: Application Layer 29
P 2 P: problems with centralized directory r Single point of failure r Performance bottleneck r Copyright infringement file transfer is decentralized, but locating content is highly decentralized 2: Application Layer 30
Query flooding: Gnutella r fully distributed m no central server r public domain protocol r many Gnutella clients implementing protocol overlay network: graph r edge between peer X and Y if there’s a TCP connection r all active peers and edges is overlay net r Edge is not a physical link r Given peer will typically be connected with < 10 overlay neighbors 2: Application Layer 31
Gnutella: protocol r Query message sent over existing TCP connections r peers forward Query message ry e r Query. Hit it Qu H ry sent over e Qu reverse Query path File transfer: HTTP Query. Hit Qu ery Query. Hit Scalability: limited scope flooding Qu er y 2: Application Layer 32
Gnutella: Peer joining Joining peer X must find some other peer in Gnutella network: use list of candidate peers 2. X sequentially attempts to make TCP with peers on list until connection setup with Y 3. X sends Ping message to Y; Y forwards Ping message. 4. All peers receiving Ping message respond with Pong message 5. X receives many Pong messages. It can then setup additional TCP connections Peer leaving: see homework problem! 1. 2: Application Layer 33
Exploiting heterogeneity: Ka. Za. A r Each peer is either a group leader or assigned to a group leader. m m TCP connection between peer and its group leader. TCP connections between some pairs of group leaders. r Group leader tracks the content in all its children. 2: Application Layer 34
Ka. Za. A: Querying r Each file has a hash and a descriptor r Client sends keyword query to its group leader r Group leader responds with matches: m For each match: metadata, hash, IP address r If group leader forwards query to other group leaders, they respond with matches r Client then selects files for downloading m HTTP requests using hash as identifier sent to peers holding desired file 2: Application Layer 35
Kazaa tricks r Limitations on simultaneous uploads r Request queuing r Incentive priorities r Parallel downloading 2: Application Layer 36
- Pigmented layer and neural layer
- Brush border enzymes
- Secure socket layer and transport layer security
- Presentation layer functions
- Secure socket layer and transport layer security
- Secure socket layer and transport layer security
- Secure socket layer and transport layer security
- Layer 2 e layer 3
- Layer-by-layer assembly
- Layer 2 vs layer 3 bitstream
- Pgp osi layer
- Ftp application layer
- Dns application layer protocol
- Domain name system in application layer
- Application layer domain name system
- Layer 7 application
- Application-layer protocol negotiation
- Application layer message
- Introduction to application layer
- Application layer protocols
- Application layer protocols
- Application layer
- Telnet application layer
- Application layer
- Recursive and iterative query
- Application layer protocols
- Application layer protocols
- Application layer protocols
- Application layer protocols
- Principles of reliable data transfer in transport layer
- Application of ultrasonic inspection
- Slab vs splint
- Chapter 3 transport layer
- 18.4 participating in a job interview
- Chapter 18 preparing for the world of work
- Chapter 3 application software
- Chapter 5 elasticity and its application multiple choice