Chapter 2 - Application Layer
Chapter 2 - Application Layer
APPLICATION LAYER
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
OUTLINE
1. Application Architectures
2. Web & HTTP
3. DNS (Domain Name System)
4. FTP service
5. P2P applications
6. Electronic mail
2
1. APPLICATION
ARCHITECTURES
Faculty of Information Technology
PhD. Le Tran Duc
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
• e-mail
• web
• text messaging
• remote login
• P2P file sharing
• multi-user network games
• streaming stored video (YouTube, Hulu, Netflix)
• voice over IP (e.g., Skype)
• real-time video conferencing
• social networking
• search
• …
4
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
5
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
• client-server
• peer-to-peer (P2P)
6
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
CLIENT-SERVER ARCHITECTURE
Server:
• always-on host
• permanent IP address
• data centers for scaling
Clients:
• communicate with server
• may be intermittently connected
• may have dynamic IP addresses
• do not communicate directly with each other
7
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
P2P ARCHITECTURE
• No always-on server
• Arbitrary end systems directly communicate
• Peers request service from other peers, provide
service in return to other peers
o Self scalability – new peers bring new
service capacity, as well as new service
demands
• Peers are intermittently connected and change
IP addresses
o Complex management
8
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
PROCESSES COMMUNICATING
How the programs, running in multiple end systems, communicate with each other?
clients, servers
9
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
SOCKETS -
10
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
ADDRESSING PROCESSES
• To receive messages, process must • Identifier includes both IP address and port numbers
have identifier associated with process on host.
• Host device has unique 32-bit IP • Example port numbers:
address o HTTP server: 80
• Question: does IP address of host on o Mail server: 25
which process runs suffice for
• To send HTTP message to mangmaytinh.com web
identifying the process?
server:
- Answer: no, many processes can o IP address: 128.119.245.12
be running on same host
o Port number: 80
• More shortly…
11
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
13
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
15
2. WEB & HTTP
WEB
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
17
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
HTTP OVERVIEW
18
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
HTTP OVERVIEW
19
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
HTTP OVERVIEW
Persistent HTTP
Non-persistent HTTP • Multiple objects can be sent
• At most one object sent over single TCP connection
over TCP connection between client, server
o Connection then closed • Server leaves connection
• Downloading multiple open after sending response
NON-PERSISTENT HTTP
(contains text,
suppose user enters URL: references to 10
www.someSchool.edu/someDepartment/home.index jpeg images)
1a. HTTP client initiates TCP
connection to HTTP server
1b. HTTP server at host
(process) at www.someSchool.edu
www.someSchool.edu on port 80 waiting for TCP connection
at port 80. “accepts”
2. HTTP client sends HTTP connection, notifying client
request message (containing
URL) into TCP connection 3. HTTP server receives
socket. Message indicates request message, forms
that client wants object response message
someDepartment/home.inde containing requested object,
x and sends message into its
time socket
21
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
22
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
23
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
EXAMPLE
GET
/kurose_ross_sandbox/interactive/quotation8.htm
HTTP/1.0
Host: gaia.cs.umass.edu
QUESTION LIST
If-Modified-Since: Mon, 27 Jul 2020 16:21:57 -0700
1. What is the name of the file that is being retrieved in this GET
message?
2. What version of HTTP is the client running?
3. True or False: The client already has a cached copy of the file
24
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
25
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
26
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
EXAMPLE
HTTP/1.1 200 OK
Date: Mon, 27 Jul 2020 23:12:22 +0000
Server: Apache/2.2.3 (CentOS)
Last-Modified: Mon, 27 Jul 2020 QUESTION LIST
23:15:22 +0000
ETag:17dc6-a5c-bf716880. 1. Is the response message using HTTP 1.0 or HTTP 1.1?
Content-Length: 51389 2. Was the server able to send the document successfully? Yes
Keep-Alive: timeout=33, max=79 or No
Connection: Keep-alive 3. How big is the document in bytes?
Content-type: image/html 4. Is the connection persistent or nonpersistent?
5. What is the type of file being sent by the server in response?
6. What is the name of the server and its version? Write your
answer as server/x.y.z
7. Will the ETag change if the resource content at this particular
resource location changes? Yes or No
27
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
ASSIGNMENT 1
28
3. DNS (DOMAIN
NAME SYSTEM)
Faculty of Information Technology
PhD. Le Tran Duc
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
31
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
EXAMPLE
Iterated query:
33
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
EXAMPLE
Recursive query:
34
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
DNS RECORDS
• A resource record, commonly referred to as an RR, is the unit of information entry in DNS
database
• RRs are used to resolve all DNS queries
• Including:
o Start of Authority (SOA)
o Name Server (NS)
o Host (A)
o Host (AAAA)
o Canonical Name (CNAME)
o Mail Exchanger (MX)
o Pointer (PTR)
o Service Record (SRV)
35
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
36
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
PROBLEMS
Imagine that you are trying to visit www.enterprise.com, but you don't
remember the IP address the web-server is running on.
•(dns.enterprise.com, 146.54.6.147, A)
•(west5.enterprise.com, 142.81.17.206, A)
•(mail.enterprise.com, 247.29.85.181, A)
37
4. FTP SERVICE
39
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
40
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
41
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
42
5. P2P APPLICATIONS
Alice arrives …
… obtains list
of peers from tracker
… and begins exchanging
file chunks with peers in torrent
45
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
46
6. ELECTRONIC MAIL
ELECTRONIC MAIL
A. User Agent
• a.k.a. “mail reader”
• composing, editing, reading mail messages
• e.g., Outlook, Thunderbird, iPhone mail client
• outgoing, incoming messages stored on server
48
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
ELECTRONIC MAIL
B. Mail Server
• Mailbox contains incoming messages for user
• Message queue of outgoing (to be sent) mail
messages
• SMTP protocol between mail servers to send
email messages
o client: sending mail server
o “server”: receiving mail server
49
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
ELECTRONIC MAIL
C. SMTP Protocol
• Uses TCP to reliably transfer email message from
client to server, port 25
• Direct transfer: sending server to receiving server
• Three phases of transfer
o handshaking (greeting)
o transfer of messages
o closure
50
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
1) Alice uses UA to compose message “to” 4) SMTP client sends Alice’s message over the TCP
[email protected] connection
2) Alice’s UA sends message to her mail server; 5) Bob’s mail server places the message in Bob’s mailbox
message placed in message queue 6) Bob invokes his user agent to read message
3) client side of SMTP opens TCP connection
with Bob’s mail server
51
FACULTY OF INFORMATION TECHNOLOGY
PhD. LE TRAN DUC
52