2. Electronic Mail
outgoing
message queue
user mailbox
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
agent
mail
server
user
agent
SMTP
SMTP
mail
server
user
agent
SMTP
user
agent
mail
server
user
agent
user
agent
3. Electronic Mail
Mail Servers
r Each recipient has a mailbox
located in one of the mail servers
r Mailbox manages and maintains the
mail
messages that have been sent to
server
him.
r Message queue of outgoing (to be
sent) mail messages
SMTP
r 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
SMTP
SMTP
user
agent
user
agent
mail
server
user
agent
user
agent
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 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
5. 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
6. SMTP and HTTP
r
SMTP uses persistent connections
Can send all of the messages over the same TCP connection
Comparison with HTTP:
r
HTTP transfer files from web server to web client
r
SMTP from one mail server to another
r
Both use Persistent Connections
r
HTTP: pull
r
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
7. Mail Access Protocols
SMTP
SMTP
user
agent
sender’s mail
server
r
r
r
access
protocol
receiver’s mail
server
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
user
agent
8. 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
9. Examples of P2P Technologies
File sharing Programs:
Gnutella ,Napster ,LimeWire, Kazaa
etc.
Instant messaging:
ICQ, Jabber etc
Conferencing
Netmeeting, Voice over IP (VoIP) etc
10. 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 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 content
Three approaches for organizing and searching for contents
Different approaches are used by different P2P file sharing
systems.
11. 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
3
1
1
Alice
12. File Sharing with Napster
3. Server searches
database. Finds song
on User C’s 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 C
User A
5. User A connects to
User C and downloads
song.mp3
(Song.mp3)
13. 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
14. 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
15. Query Flooding
Query message
sent over existing
TCP connections
Peers forward
Query message
Query-Hit message
sent over reverse
path
Non-scalable
Significant amount of
traffic among the peers
in the underlying
network connecting the
peers
File transfer
Query
QueryHit
Query Hit
Query
16. 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.
17. Gnutella: Peer Joining
1.
Joining peer X must find another peer in the overlay
network
2.
3.
4.
5.
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
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
18. 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 relationships
in overlay network