0% found this document useful (0 votes)
31 views43 pages

Application Layer

The document discusses computer networks and the application layer. It provides details about an upcoming lecture on the application layer by Dr. Madiha Amjad at the Institute of Information Technology at Khawaja Fareed University of Engineering and Technology. The lecture will cover topics like the application layer paradigm, application architectures including client-server and peer-to-peer models, examples like the World Wide Web and electronic mail, and protocols used for electronic mail.

Uploaded by

muh.bilaltariq19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views43 pages

Application Layer

The document discusses computer networks and the application layer. It provides details about an upcoming lecture on the application layer by Dr. Madiha Amjad at the Institute of Information Technology at Khawaja Fareed University of Engineering and Technology. The lecture will cover topics like the application layer paradigm, application architectures including client-server and peer-to-peer models, examples like the World Wide Web and electronic mail, and protocols used for electronic mail.

Uploaded by

muh.bilaltariq19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 43

Computer Networks

COSC-3101
Course Instructor: Dr. Madiha Amjad
[email protected]

Lecture : Application Layer


Institute of Information Technology
Khawaja Fareed University of Engineering and
Technology (KFUEIT)
Application Layer

 The application layer provides services to the user.


Communication is provided using a logical connection, which
means that the two application layers assume that there is an
imaginary direct connection through which they can send and
receive messages.
Application Layer Paradigm

 It should be clear that to use the Internet we need two application


programs to interact with each other: one running on a computer
somewhere in the world, the other running on another computer
somewhere else in the world.
 The two programs need to send messages to each other through the
Internet infrastructure.
Application architectures

Network applications can be categorized as:

 Client-server
 Peer-to-peer (P2P)
 Hybrid of Client-server and P2P

All of the above falls under the umbrella of “Distribute Processing”

Chap 2: Application Layer 4


Figure 25.2: Example of a client-server paradigm

25.5
Client-server architecture

server:
 Runs server apps on always-on host with permanent IP address
 Server farms for scaling—usually clustered computers to serve large
# of clients—
Google cluster is estimated to have about 31,000 computers!
clients:
 Communicate with server
 May be intermittently connected
 May have dynamic IP addresses
 Do not communicate directly with each other

Chap 2: Application Layer 6


Pure P2P architecture

 No always-on server
 Arbitrary end systems directly communicate
 Peers are intermittently connected and change IP addresses

‒ Highly scalable

‒ But difficult to manage


Figure 25.3: Example of a peer-to-peer paradigm

25.8
Hybrid of client-server and P2P

Napster
‒File transfer P2P
‒File search centralized:
•Peers query same central server to locate content
•Peers register content into a directory at central server
Instant messaging
‒Chatting between two users is P2P
‒Presence detection/location centralized:
•User registers its IP address with central server when it comes online
•User contacts central server to find IP addresses of buddies
Skype
‒Internet telephony app—voice & video conferencing
‒Finding address of remote party: centralized server(s)
‒Client-client connection is direct (not through server)
World Wide Web

 World Wide Web (abbreviated WWW or Web).

 Hyper-Text Transfer Protocol (HTTP), is the most common client-


server application program used in relation to the Web.
World Wide Web Architecture

 The WWW today is a distributed client-server service, in which a


client using a browser can access a service using a server.
 The service provided is distributed over many locations called sites.
 Each site holds one or more web pages. Each web page can contain
some links to other web pages in the same or other sites.
• Simple web page has no links to other web pages.
• Composite web page has one or more links to other web pages.
• Each web page is a file with a name and address.
 Web Server
‒ The web page is stored at the server. Each time a request arrives, the
corresponding document is sent to the client.
Hypertext Transfer Protocol

 The HyperText Transfer Protocol (HTTP) is used to define how the


client-server programs can be written to retrieve web pages from
the Web.
 An HTTP client sends a request; an HTTP server returns a response.
 The server uses the port number 80; the client uses a temporary
port number.
 HTTP uses the services of TCP, which, as discussed before, is a
connection-oriented and reliable protocol.
Persistent HTTP

Non-persistent HTTP issues: Persistent HTTP


 Requires 2 RTTs per object  server leaves connection
open after sending response
 OS overhead for each TCP
connection  subsequent HTTP messages
between same client/server
 Browsers often open parallel sent over open connection
TCP connections to fetch
referenced objects  client sends requests as soon
as it encounters a referenced
object
 As little as one RTT for all the
referenced objects
Lecture 4 Application Layer 1-13
HTTP Connection

Persistent HTTP
Nonpersistent HTTP  Multiple objects can be
 At most one object is sent over single TCP
sent over a TCP connection between
connection. client and server.
 HTTP/1.0 uses  HTTP/1.1 (1999) uses
nonpersistent HTTP persistent connections
in default mode
Uniform Resource Locator

 The uniform resource locator (URL) combine four identifiers to


define the web page to distinguish it from other web pages:
‒ Protocol: the client-server program that we need in order to access the web
page (HTTP or FTP).
‒ Host: IP address of the server or the unique name given to the server such as
forouzan.com.
‒ Port: the client-server application. If the HTTP protocol is used for accessing
the web page, the well-known port number is 80. if a different port is used,
the number canbe explicitly given.
‒ Path: The path identifies the location and the name of the file in the
underlying operating system. For example, /top/next/last/myfile is a path that
uniquely defines a file named myfile.
Example

 The URL http://www.mhhe.com/compsci/forouzan/ defines the


web page.

 The string www.mhhe.com is the name of the computer in the


McGraw-Hill company (the three letters www are part of the host
name and are added to the commercial host).

 The path is compsci/forouzan/, which defines Forouzan’s web page


under the directory compsci
 (computer science).
Electronic Mail

 Electronic mail (or e-mail) allows users to exchange messages. The


nature of this application is different from other applications
discussed so far. This means that the idea of client/server
programming should be implemented in another way: using some
intermediate computers (servers).
Figure 26.12: Common scenario
the sender and the receiver, Alice and Bob, are connected to two mail servers. The administrator has
created one mailbox for each user. A mailbox is part of a server hard drive, a special file with permission
restrictions. Only the owner of the mailbox has access to it.
When Alice needs to send a message to Bob, she runs a user agent (UA) program to prepare the message
and send it to her mail server. The mail server at her site uses a queue (spool) to store messages waiting to
be sent. The message needs to be sent through the Internet from Alice’s site to Bob’s site using a message
transfer agent (MTA). Here two message transfer agents are needed: one client and one server. The server
needs to run all the time because it does not know when a client will ask for a connection. The client, on
the other hand, can be triggered by the system when there is a message in the queue to be sent.

1 9
2
8

3 7
The user agent at the Bob site
allows Bob to read the received
message. Bob later uses a
5 6
4 message access agent client to
retrieve the message from a
message access agent server
running on the second server.
26.18
Figure 26.14: E-mail address

In the Internet, the address consists of two parts:


1. Local part: defines the name of a special file, called the user
mailbox, where all the mail received for a user is stored for
retrieval by the message access agent.
2. Domain name: An organization usually selects one or more hosts
to receive and send e-mail; they are sometimes called mail
servers or exchangers.

26.19
Figure 26.15: Protocols used in electronic mail

For MTA, the message needs to be pushed from the client to the server (need a push protocol)
 Simple Mail Transfer Protocol (SMTP).

For MAA, the client must pull messages from the server (need a pull protocol) POP and
IMAP.

26.20
Electronic Mail: mail servers
outgoing
message queue
2) Mail Servers user mailbox
 mailbox contains user
incoming messages for agent
user mail
user
 message queue of server
agent
outgoing (to be sent) mail SMTP
mail
messages server user
 SMTP protocol between SMTP agent

mail servers to send email SMTP


messages mail user
‒ client: sending mail server agent

server
‒ “server”: receiving mail user
agent
server user
agent

Chap 2: Application Layer 21


26.3.2 Web-Based Mail

E-mail is such a common application that some


websites today provide this service to anyone who
accesses the site.
Three common sites are Hotmail, Yahoo, and Google
mail. The idea is very simple. Figure 26.22 shows two
cases.

26.22
Figure 26.22: Web-based e-mail, cases I and II

Case I: Alice, uses a mail server; Bob, the receiver,


has an account on a web-based server.
Mail transfer from Alice’s browser to her traditional
mail serve, and from the sending mail server to the
receiving mail server is through SMTP. However, the
message from the receiving server (the web server) to
Bob’s browser is done through HTTP., instead of
using POP3 or IMAP4.
When Bob needs to retrieve his e-mails, he sends a
request HTTP message to the website (Hotmail, for
example). The website sends a form to be filled in by
Bob (the log-in name and the password).
If the log-in name and password match, the list of e-
mails is transferred from the web server to Bob’s
browser in HTML format.
Case 2: In the second case, both Alice and Bob use
web servers. Alice sends an HTTP request message to
her web server using the name and address of Bob’s
mailbox as the URL. The server at the Alice site
passes the message to the SMTP client and sends it to
the server at the Bob site using SMTP protocol. Bob
receives the message using HTTP transactions. SMTP
protocol. Is used to transfer the message from the
server at the Alice site to the server at the Bob site.
26.23
Why do we need DNS?

 Too difficult to remember IP addresses and if a server is changed


everyone would need to be notified of the new IP address
 Originally one file with names and IP addresses – became too
large
 Host name conflicts began to occur
 DNS was developed to solve these problems
 DNS is a hierarchical domain based naming scheme and a
database system for implementing it.
 It is used primarily for mapping host names to IP addresses
How DNS works

To map a name to an IP address:


• Application program calls a library procedure called a resolver,
for example gethostname, passing it the name as a parameter.
• The resolver sends a query with the name to a local DNS server,
which looks up the name and returns the IP address.
• The query and response are sent as UDP packets.
• Once it has the IP address the host can now establish a TCP
connection or send UDP packets.
DNS Name Space

 ICANN – (Internet Corporation for Assigned Names and Numbers)


‒ Established in 1998 to manage naming hierarchy
‒ Internet is divided into 250 top level domains, each partitioned into
subdomains
‒ Top level domains are Generic ( originals from 1980’s as well as newer
additions ) or Countries (one entry per country)
‒ Original 1985 domains were com, edu, gov, int, mil net, org
‒ Top level domains are run by registrars appointed by ICANN
‒ New domains have been added, but often with disagreements ( pro, etc.) as to
their use.
‒ Domain names are NOT case sensitive
‒ Registering a domain with the intent to sell it is called cybersquatting
The DNS Name Space

DNS namespace is hierarchical from the root down


‒ Different parts delegated to different organizations

The computer robot.cs.washington.edu

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Distributed, Hierarchical Database
Root servers

TLD servers
Root DNS Servers
Authoritative
DNS
servers

com DNS servers org DNS servers edu DNS servers

pbs.org poly.edu umass.edu


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

Client wants IP for www.amazon.com; 1st approx:


 Client queries a root server to find com DNS server
 Client queries com DNS server to get amazon.com DNS server
 Client queries amazon.com DNS server to get IP address for
www.amazon.com

Chap 2: Application Layer 28


DNS: Root name servers

 contacted by local name server that can not resolve name


 root name server:
‒ 13 currently—named such as a.root-servers.net a.root-servers.net
to m.root-servers.net
‒ Root name servers have database for all TLD servers

29
TLD and Authoritative Servers

 Top-level domain (TLD) servers: responsible for


gTLD(generic TLD) and ccTLD(country code TLD)
‒ Network solutions maintains servers for com TLD
‒ Educause for edu TLD
 Authoritative DNS servers: organization’s DNS
servers, providing authoritative hostname to IP
mappings for organization’s servers (e.g., Web and
mail).
‒ Can be maintained by organization or ISP

Chap 2: Application Layer 30


Local Name Servers

 Each ISP (residential ISP, company, university) has one.


‒ Also called “default name server” of a zone
 When a host makes a DNS query, query is sent to its local DNS
server
‒ Depending upon a query (either “iterative query” or “recursive query”) the
server acts differently
‒ Also depending upon the server settings (“iterative service” or “recursive
service”) the server acts differently

Chap 2: Application Layer 31


DNS: caching and updating records

 once (any) name server(also dns client) learns mapping, it caches the mapping
‒ cache entries timeout (TTL) after some time
‒ TLD servers typically cached in local name servers
• Thus root name servers not often visited
• Typically a name server may contact a root server every 48 hours on the average
 Static or Dynamic DNS
‒ Static DNS – entries on DNS servers manually updated
‒ Dynamic DNS (DDNS—RFC 2136): Hosts register to DNS server in real time—READ
‒ DDNS useful when IP addresses change usually by DHCP
‒ Used in Windows Active Directory
‒ Also popularly used for home computers with DNS names

Chap 2: Application Layer 32


DNS records in DNS database

RR format: (name, value, type, ttl)

DNS: distributed db storing resource records (RR)


 Type=A  Type=CNAME
 name is hostname  name is alias name for some
 value is IP address “canonical” (the real) name
www.ibm.com is really

 Type=NS servereast.backup2.ibm.c
‒ name is domain (e.g. om
foo.com)  Type=MX
 value is canonical name
‒ value is hostname of  value is name of
authoritative name server
for this domain mailserver associated with
name
Try http://www.iptools.com/ or http://mydnstools.info/ Any other tools found?

Chap 2: Application Layer 33


Pure P2P architecture

 no always-on server
 arbitrary end systems directly
communicate
 peers are intermittently connected peer-peer
and change IP addresses

‒ File distribution

34
Server-client vs. P2P: example

Client upload rate = u, F/u = 1 hour, us = 10u, dmin ≥ us

3.5
P2P
Minimum Distribution Time

3
Client-Server
2.5

1.5

0.5

0
0 5 10 15 20 25 30 35

Chap 2: Application Layer 35


File distribution: BitTorrent

 P2P file distribution


torrent: group of
tracker: tracks peers peers exchanging
participating in torrent chunks of a file

obtain list
of peers

trading
chunks

peer

36
BitTorrent (1)
 file divided into 256KB chunks.
 peer joining torrent:
‒ has no chunks, but will accumulate them over time
‒ registers with tracker to get list of peers, connects to
subset of peers (“neighbors”)
 while downloading, peer uploads chunks to other peers.
 peers may come and go
 once peer has entire file, it may (selfishly) leave or
(altruistically) remain

Chap 2: Application Layer 37


BitTorrent (2)
Sending Chunks: tit-for-tat
 Alice sends chunks to
Pulling Chunks
four neighbors currently
 at any given time, sending her chunks at
different peers have
different subsets of file the highest rate
chunks  re-evaluate top 4

 periodically, a peer (Alice) every 10 secs


asks each neighbor for list  every 30 secs: randomly
of chunks that they have. select another peer,
 Alice sends requests for starts sending chunks
her missing chunks  newly chosen peer
‒ rarest first may join top 4
 “optimistically
unchoke”

Chap 2: Application Layer 38


BitTorrent: Tit-for-tat
(1) Alice “optimistically unchokes” Bob
(2) Alice becomes one of Bob’s top-four providers; Bob reciprocates
(3) Bob becomes one of Alice’s top-four providers

With higher upload rate,


can find better trading
partners & get file faster!

Chap 2: Application Layer 39


P2P: centralized index

original “Napster” design Bob


1) when peer connects, it informs centralized
directory server
central server: 1
‒ IP address peers
‒ content 1

2) Alice queries for “Hey Jude”


1 3
3) Alice requests file from Bob
2 1

Alice

Chap 2: Application Layer 40


P2P: problems with centralized directory

 single point of failure


 performance bottleneck file transfer is decentralized, but
locating content is highly
 copyright infringement:
centralized
“target” of lawsuit is obvious

Chap 2: Application Layer 41


Major issues for P2P

 Security—e.g. malicious code posted on P2P networks


 Privacy
 Anonymity
 Copyright infringement
 Intellectual property

Chap 2: Application Layer 42


Any
Question?

You might also like