You are on page 1of 34

Application layer

our goals:  learn about protocols by


 conceptual, examining popular
implementation aspects application-level
of network application protocols
protocols  HTTP
 transport-layer  FTP
service models  SMTP / POP3 / IMAP
 client-server
paradigm
 peer-to-peer
paradigm

Application Layer 2-1


Some network apps
 e-mail  voice over IP (e.g., Skype)
 web  real-time video
 text messaging conferencing
 remote login  social networking
 P2P file sharing  search
 multi-user network games  …
 streaming stored video  …
(YouTube, Hulu, Netflix)

Application Layer 2-2


Creating a network app application
transport
network
data link

write programs that: physical

 run on (different) end systems


 communicate over network
 e.g., web server software
communicates with browser
software

no need to write software for application

network-core devices transport


network
application
data link
 network-core devices do not physical transport
network
run user applications data link
physical

 applications on end systems


allows for rapid app
development, propagation

Application Layer 2-3


Application architectures
possible structure of applications:
 client-server
 peer-to-peer (P2P)

Application Layer 2-4


Client-server architecture
server:
 always-on host
 permanent IP address
 data centers for scaling

clients:
 communicate with server
client/server  may be intermittently
connected
 may have dynamic IP
addresses
 do not communicate directly
with each other

Application Layer 2-5


P2P architecture
 no always-on server peer-peer
 arbitrary end systems
directly communicate
 peers request service from
other peers, provide service
in return to other peers
 self scalability – new
peers bring new service
capacity, as well as new
service demands
 peers are intermittently
connected and change IP
addresses
 complex management

Application Layer 2-6


Internet apps: application, transport protocols

application underlying
application layer protocol transport protocol

e-mail SMTP [RFC 2821] TCP


remote terminal access Telnet [RFC 854] TCP
Web HTTP [RFC 2616] TCP
file transfer FTP [RFC 959] TCP
streaming multimedia HTTP (e.g., YouTube), TCP or UDP
RTP [RFC 1889]
Internet telephony SIP, RTP, proprietary
(e.g., Skype) TCP or UDP
RTP: Real time transport Protocol
SIP: Session initiation Protocol
HTTP: Hyper text transfer protocol
SMTP: Simple mail transfer protocol
FTP: File Transport Protocol
RFC: Request for comments
Application Layer 2-7
Web and HTTP
First, a review…
 web page consists of objects
 object can be HTML file, JPEG image, Java
applet, audio file,…
 web page consists of base HTML-file which
includes several referenced objects
 each object is addressable by a URL, e.g.,
www.someschool.edu/someDept/pic.gif

host name path name

Application Layer 2-8


HTTP overview
HTTP: hypertext transfer
protocol HT
 Web’s application layer TP
req
ues
protocol PC running HT t
Firefox browser TP
 client/server model res
pon
se
 client: browser that
requests, receives, t
(using HTTP protocol) u es
req server
and “ displays” Web T P n se
HT s po running
objects TP
r e Apache Web
T
 server: Web server H server
sends (using HTTP
protocol) objects in iphone running
response to requests Safari browser

Application Layer 2-9


HTTP overview (continued)
uses TCP: HTTP is “stateless”
 client initiates TCP  server maintains no
connection (creates socket) information about
to server, port 80 past client requests
 server accepts TCP
connection from client
 HTTP messages
(application-layer protocol
messages) exchanged
between browser (HTTP
client) and Web server
(HTTP server)
 TCP connection closed

Application Layer 2-10


HTTP connections
non-persistent HTTP persistent HTTP
 at most one object sent  multiple objects can
over TCP connection be sent over single
 connection then TCP connection
closed between client, server
 downloading multiple
objects required
multiple connections

Application Layer 2-11


Uploading form input
POST method:
 web page often includes
form input
 input is uploaded to server
in entity body

URL method:
 uses GET method
 input is uploaded in URL
field of request line:
www.somesite.com/animalsearch?monkeys&banana

Application Layer 2-12


FTP: the file transfer protocol
file transfer
FTP FTP FTP
user client server
interface
user
at host remote file
local file system
system

 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
Application Layer 2-13
FTP: separate control, data connections
TCP control connection,
 FTP client contacts FTP server server port 21
at port 21, using TCP
 client authorized over control TCP data connection,
connection FTP server port 20 FTP
client server
 client browses remote
directory, sends commands
over control connection  server opens another TCP
data connection to transfer
 when server receives file another file
transfer command, server
opens 2nd TCP data connection  control connection: “out of
(for file) to client band”
 after transferring one file,  FTP server maintains “ state
server closes data connection ” : current directory, earlier
authentication

Application Layer 2-14


Figure 26.10: FTP

Control
connection

Data
connection

26.15
Electronic mail outgoing
message queue
user mailbox
Three major components: user
agent
 user agents
 mail servers mail user
server
 simple mail transfer protocol: agent
SMTP SMTP mail user
server agent
User Agent SMTP
 a.k.a. “ mail reader” user
 composing, editing, reading
SMTP agent
mail
mail messages server
 e.g., Outlook, Thunderbird, user
agent
iPhone mail client, gmail
 outgoing, incoming messages user
agent
stored on server
Application Layer 2-16
Electronic mail: mail servers
mail servers: user
agent
 mailbox contains incoming
messages for user mail user
server agent
 message queue of outgoing
(to be sent) mail messages SMTP mail user
 SMTP protocol between server agent
mail servers to send email SMTP
messages user
 client: sending mail SMTP agent
mail
server server
user
 “ server” : receiving mail agent
server
user
agent

Application Layer 2-17


Electronic Mail: SMTP [RFC 2821]
 uses TCP to reliably transfer email message from
client to server, port 25
 direct transfer: sending server to receiving server
 three phases of transfer
 handshaking (greeting)
 transfer of messages
 closure

Application Layer 2-18


Scenario: Alice sends message to Bob
1) Alice uses UA to compose 4) SMTP client sends Alice’s
message “ to” message over the TCP
bob@someschool.edu connection
2) Alice’s UA sends message to 5) Bob’s mail server places the
her mail server; message message in Bob’s mailbox
placed in message queue 6) Bob invokes his user agent to
3) client side of SMTP opens read message
TCP connection with Bob’s
mail server

1 user mail user


mail agent
agent server server
2 3 6
4
5
Alice’s mail server Bob’s mail server
Application Layer 2-19
Mail access protocols
user
mail user
SMTP SMTP access
agent agent
protocol
(e.g., POP,
IMAP)

sender’s mail receiver’s mail


server server
 SMTP: delivery/storage to receiver’s server
 mail access protocol: retrieval from server
 POP: Post Office Protocol [RFC 1939]: authorization, download
 IMAP: Internet Mail Access Protocol [RFC 1730]: more features, including
manipulation of stored msgs on server
 HTTP: displays multimedia information

 USER AGENTS: gmail, Hotmail, Yahoo! Mail, etc.

Application Layer 2-20


DOMAIN NAME SYSTEM (DNS)

The Internet needs to have a directory system that can map a name to
an address. This is analogous to the telephone network. Figure 26.28
shows how TCP/IP uses a DNS client and a DNS server to map a
name to an address.

26.21
Figure 26.28: Purpose of DNS

26.22
Name Space

To be unambiguous, the names assigned to machines must be


carefully selected from a name space with complete control over the
binding between the names and IP addresses. In other words, the
names must be unique because the addresses are unique. A name
space that maps each address to a unique name can be organized in
two ways: flat or hierarchical.

26.23
Figure 26.29: Domain name space

26.24
Figure 26.30: Domain names and labels

26.25
Figure 26.31: Domains

26.26
Figure 26.32: Hierarchy of name servers

26.27
DNS in the Internet

DNS is a protocol that can be used in different platforms. In the


Internet, the domain name space (tree) was originally divided into
three different sections:

generic domains, country domains, and the inverse domains.

However, due to the rapid growth of the Internet, it became


extremely difficult to keep track of the inverse domains, which could
be used to find the name of a host when given the IP address. The
inverse domains are now deprecated (see RFC 3425). We, therefore,
concentrate on the first two.

26.28
Figure 26.34: Generic domains

26.29
Table 26.12: Generic domain labels

26.30
Figure 26.35: Country domains

26.31
Resolution

Mapping a name to an address is called name-address resolution.


DNS is designed as a client-server application. A host that needs to
map an address to a name or a name to an address calls a DNS client
called a resolver. The resolver accesses the closest DNS server with
a mapping request. If the server has the information, it satisfies the
resolver; otherwise, it either refers the resolver to other servers or
asks other servers to provide the information.

26.32
Figure 26.36: Recursive resolution

7
6
1 4
8

26.33
Figure 26.37: Iterative resolution

2
1
8 4
5
6 7

26.34

You might also like