You are on page 1of 22

Chapter 2 Application Layer

Computer Networking: A Top Down Approach,

4th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007.

Last Lecture

DNS SMTP

Todays Lecture

P2P

Electronic Mail
Asynchronous Communication Medium Three major components:
User Agents Mail Servers Simple Mail Transfer Protocol: SMTP
user agent mail server

outgoing message queue user mailbox

user agent

SMTP SMTP SMTP


mail server user agent user agent

mail server

user agent

User Agent a.k.a. mail reader composing, editing, reading mail messages e.g., Eudora, Outlook, Mozilla Thunderbird Sends message to the mail server

user agent

Electronic Mail
Mail Servers Each recipient has a mailbox located in one of the mail servers Mailbox manages and maintains the mail messages that have been sent to server him. Message queue of outgoing (to be sent) mail messages SMTP Simple Mail Transfer Protocol (SMTP) between mail servers to send email messages mail Client and Server server Both client and sever sides of SMTP run on every mail server. Runs on TCP at port 25. user agent RFC 5321
user agent user agent mail server user agent

SMTP

SMTP

user agent

user agent

Sample SMTP Interaction


Client SMTP establishes a TCP connection with Server SMTP Application Layer handshaking to introduce themselves Sample SMTP Interaction
S: 220 hamburger.edu (Service Ready) 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 (All lines after DATA command are treated as the mail message) 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

Mail Access Protocols


SMTP
user agent senders mail server receivers mail server

SMTP

access protocol

user agent

SMTP: delivery/storage to receivers server Mail access protocol: retrieval from server

POP: Post Office Protocol [RFC 1939] IMAP: Internet Mail Access Protocol [RFC 1730] HTTP: Gmail, Hotmail, Yahoo! Mail, etc. User agent is ordinary web browser HTTP to send email to web server HTTP to access mail box

Distributed, Hierarchical Database


Root DNS Servers

com DNS servers yahoo.com amazon.com DNS servers DNS servers

org DNS servers pbs.org DNS servers

edu DNS servers poly.edu umass.edu DNS serversDNS servers

Client wants IP for www.amazon.com: Client first queries a root server The root server returns the IP addresses for TLD servers for the top level domain com The client then contacts one of the TLD servers which returns the IP address of an authoritative server for amazon.com The authoritative server then returns the IP address for the host name www.amazon.com

DNS name resolution example


Host at cis.poly.edu
2

root DNS server

3 4 5 local DNS server


dns.poly.edu

wants IP address for gaia.cs.umass.edu

TLD DNS server

Iterated query:

Contacted server replies with name of server to contact I dont know this name, but ask this server

requesting host
cis.poly.edu

authoritative DNS server dns.cs.umass.edu

gaia.cs.umass.edu

DNS name resolution example


Recursive Query:

root DNS server

Puts burden of name resolution on other server


DNS Caching Extensively used

6 TLD DNS server

local DNS server


dns.poly.edu

Cache entries timeout (disappear) after some time TLD servers typically cached in local name servers Thus root name servers not often visited

8
authoritative DNS server dns.cs.umass.edu

requesting host
cis.poly.edu

gaia.cs.umass.edu

Pure P2P Architecture

no always-on server

Arbitrary end systems

directly communicate Peers are intermittently connected and change IP addresses


P2P is a class of applications

peer-peer

that takes advantage of resources e.g. storage, content, human presence, available at the edges of the Internet

Examples of P2P Technologies


File sharing Programs: Gnutella ,Napster ,LimeWire, Kazaa etc.

Instant messaging:
ICQ, Jabber etc

Conferencing Netmeeting, Voice over IP (VoIP) etc

P2P File Sharing


Alice runs P2P client

application on her notebook computer Intermittently connects to Internet; gets new IP address for each connection Registers her content in P2P system

Asks for some music file Application displays other peers that have copy of that file. Alice chooses one of the peers, Bob. File is copied from Bobs PC to Alices notebook: P2P While Alice downloads, other users uploading from Alice.

How a peer determines which peers have the desired content Three approaches for organizing and searching for contents Different approaches are used by different P2P file sharing systems.

P2P: Centralized Index


original Napster design When peer connects, it informs central server: centralized directory server IP address Content that it is making available Central Server collects info from peers that becomes active Creates a centralized dynamic 2 database that maps each object name to a set of IP addresses Hybrid of P2P and client-server File distribution is P2P Search is client-server
Bob

1 peers 1 1 1 3

Alice

File Sharing with Napster

3. Server searches database. Finds song on User Cs machine

www.napster.com Main Server


File List: UserC song.mp3 UserD another.mp3 ..

1. Construct Database Users connect to Napster Server Server builds up a list of available songs and locations

User B

2. User A searches for song.mp3

4. Server informs User A of the location of song.mp3

User D
(Another.mp3)

User A
5. User A connects to User C and downloads song.mp3

User C
(Song.mp3)

P2P: Problems with Centralized Directory


Single Point of Failure If directory server crashes, the entire P2P application crashes. Performance Bottleneck Thousands of connected users Server must maintain a huge database and must respond to thousands of queries per second Copyright Infringement Easy to obtain copyrighted material for free Heavy metal rock group Metallica sued Napster for copyright infringement in April 2000.

file transfer is decentralized, but locating content is highly centralized

Decentralized Directory
Query Flooding Directory/Index is fully distributed over the community of peers No central server Used by Gnutella Each peer indexes the files it makes available for sharing (and no other files) Overlay Network:
Peers form an abstract,

logical network called an overlay network Edge between peer X and Y if theres a TCP connection All active peers and edges form overlay network edge: virtual (not physical) link Overlay network may have thousands of participating peers but Given peer typically connected with < 10 overlay neighbors

Query Flooding
Query message sent over existing TCP connections Peers forward Query message Query-Hit message sent over reverse path
Non-scalable Query Hit Query File transfer

Query
QueryHit

Significant amount of traffic among the peers in the underlying network connecting the peers

Limited Query Flooding


A

limit (say, 7). Each time the query message reaches a new peer, the peer decrements the peer-count field before forwarding the query to its overlay neighbor. Stops forwarding the query when peer-count field set to zero Flooding is localized to a region of the overlay network Reduces the query traffic Peer seeking the content may not be able to locate that content.

peer-count field in the message is set to specific

Gnutella: Peer Joining


1.

Joining peer X must find another peer in the overlay network


2. 3.

4. 5.

Peer X sequentially attempts TCP connections with candidate peers until connection setup with some peer Y. Peer X sends Ping message to Peer Y that forwards this message to his overlay neighbors (who then forward to their neighbors.) Peer Z on receiving Ping message respond to Peer X with Pong message (IP address) Peer X receives many Pong messages, and can then setup additional TCP connections
Creating multiple edges from itself into the overlay network

Maintain a list of peers (IP addresses ) that are often up in the overlay network Peer X can also contact a tracker site that maintains such a list

Hierarchical Overlay
Between centralized index and query

flooding approaches No dedicated server for indexing files Super Peers: Peers with high bandwidth connections into internet and high availability. Ordinary peer is assigned as a child to super peer. A new peer

Establishes a TCP connection with one of super peers Informs all the files it is sharing
ordinary peer group-leader peer neighoring relationships in overlay network

Super peer maintains an index of IP

addresses of children holding different files. Significant more peers can be checked for a match without creating an excessive quantity of query traffic

Home Assignment
Bit Torrent Protocol
See

your text book and paper on LMS

Anti-Snubbing, Pipelining, Endgame

mode, Peer Churn? Home Assignment

You might also like