week3 lec3-bscs1
DESCRIPTION
Computer NetworksTRANSCRIPT
Chapter 2Application Layer
Computer Networking: A Top Down Approach, 4th edition. Jim Kurose, Keith RossAddison-Wesley, July 2007.
Electronic Mail
Asynchronous Communication Medium
Three major components: • User Agents • Mail Servers • Simple Mail Transfer Protocol:
SMTP
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 mailbox
outgoing message queue
mailserver
useragent
useragent
useragent
mailserver
useragent
useragent
mailserver
useragent
SMTP
SMTP
SMTP
Electronic Mail
Mail Servers Each recipient has a mailbox
located in one of the mail servers
Mailbox manages and maintains the messages that have been sent to him.
Message queue of outgoing (to be sent) mail messages
Simple Mail Transfer Protocol (SMTP) between mail servers to send email messages Client and Server Both client and sever sides of
SMTP run on every mail server.
Runs on TCP at port 25. RFC 5321
mailserver
useragent
useragent
useragent
mailserver
useragent
useragent
mailserver
useragent
SMTP
SMTP
SMTP
Scenario: Alice sends message to Bob1) Alice uses UA to compose
message to [email protected]
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
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
useragent
mailserver
mailserver user
agent
1
2 3 4 56
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: <[email protected]> S: 250 [email protected]... Sender ok C: RCPT TO: <[email protected]> S: 250 [email protected] ... 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
SMTP and HTTP SMTP uses persistent connections
Can send all of the messages over the same TCP connection
Comparison with HTTP: HTTP transfer files from web server to web client
SMTP from one mail server to another
Both use Persistent Connections
HTTP: pull Someone loads information on a web server and users
use HTTP to pull this info
TCP connection is initiated by the machine that wants to receive the file
SMTP: push
Sending mail sever pushes the file to the receiving mail server
TCP connection is initiated by the machine that wants to send the file
Mail Access Protocols
SMTP: delivery/storage to receiver’s 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
IMAP and POP Part of Assignment 1
useragent
sender’s mail server
useragent
SMTP SMTP accessprotocol
receiver’s mail server
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 that takes advantage of resources e.g. storage, content, human presence, available at the edges of the Internet”
peer-peer
Examples of P2P Technologies
File sharing Programs:
Gnutella ,Napster ,LimeWire, Kazaa etc.
Instant messaging:
ICQ, Jabber etc
ConferencingNetmeeting, 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 fileApplication displays other
peers that have copy of that file.
Alice chooses one of the peers, Bob.
File is copied from Bob’s PC to Alice’s notebook: P2P
While Alice downloads, other users uploading from Alice.
How a peer determines which peers have the desired contentThree approaches for organizing and searching for contentsDifferent approaches are used by different P2P file sharing
systems.
P2P: Centralized Indexoriginal “Napster” design When peer connects, it informs
central server: IP address Content that it is making
available Central Server collects info from
peers that becomes active Creates a centralized dynamic
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
centralizeddirectory server
peers
Alice
Bob
1
1
1
12
3
www.napster.comMain Server
File List:UserC song.mp3
UserD another.mp3…..
User A
2. User A searches for song.mp3
User C(Song.mp3)
1. Construct Database• Users connect to Napster Server• Server builds up a list of available
songs and locations
User D(Another.mp3)
User B…
3. Server searches database. Finds song on User C’s machine
4. Server informs User A of the location
of song.mp3
5. User A connects to User C and downloads
song.mp3
File Sharing with Napster
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 there’s a TCP connection
All active peers and edges form overlay network
Overlay network may have thousands of participating peers but Given peer typically
connected with < 10 overlay neighbors
Query Flooding
Query
Query Hit
Query
Query
QueryHit
Query
Query
Query
Hit
File transfer Query message
sent over existing TCP connections
Peers forwardQuery message
Query-Hit message sent over reverse path
Non-scalable
Significant amount of
traffic among the peers in the underlying network connecting the peers
Limited Query Flooding
A peer-count field in the message is set to specific 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.
Gnutella: Peer Joining
1. Joining peer X must find another peer in 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
2. Peer X sequentially attempts TCP connections with candidate peers until connection setup with some peer Y.
3. Peer X sends Ping message to Peer Y that forwards this message to his overlay neighbors (who then forward to their neighbors….)
4. Peer Z on receiving Ping message respond to Peer X with Pong message (IP address)
5. Peer X receives many Pong messages, and can then setup additional TCP connections
Creating multiple edges from itself into the overlay network
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 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
ordinary peer
group-leader peer
neighoring re la tionshipsin overlay network
Assignment 1
Bit Torrent ProtocolAnti-Snubbing, Pipelining,
Endgame mode, Peer Churn?