Application Layer in Computer Networks
Application Layer in Computer Networks
IN
C
Faculty:
N
SY
BCS502 – COMPUTER NETWORKS Prof. Ashok Herur
U
[Link]@[Link]
VT Mobile: 91641 01399
Module 5
.IN
C
N
Application Layer
SY
U
VT
.IN
• The Web (www) and HTTP
C
N
• FTP – File Transfer Protocol
SY
• Electronic mail
U
• DNS – Domain Name Service VT
• TELNET
.IN
• Networks exist to support these applications.
C
• Popular applications, in the 1970’s and 1980’s:
N
• Text email
SY
• File transfer
U
• Remote access to computers
• In 1990’s:
VT
• World Wide Web (www) – surfing, searching, ecommerce.
• After 2000:
.IN
• VoIP (Voice over IP)
•
C
Videoconferencing – Skype, Facetime, Google Hangouts, ..
• YouTube
N
• Movies on Demand – Netflix
SY
• Multiplayer Online games
•
U
Social networking – Facebook, Instagram, Twitter
•
VT
Messaging Apps - WhatsApp, WeChat
• Payment Apps – Google Pay, PayTM
• Transport Apps – Ola, Uber
• Location-based Apps – Maps, traffic, services (shops, hotels, petrol pumps,..)
.IN
systems, and be able to communicate with each other over the network.
C
• For example, in a Web application, there are two distinct programs that
N
communicate with each other:
SY
• The Browser program running in the user’s host (laptop, smartphone, etc);
• The Web Server program running in the Web Server host.
U
VT
• As another example, in a video-on-demand application, like Netflix, there is:
• A Netflix-provided program running in the user’s host (TV, smartphone);
• The Netflix Server program running in the Netflix Server host.
.IN
• Client-server architecture
C
• Peer-to-Peer (P2P) architecture
N
• In a Client-server architecture, there is an always-on host, called the Server,
SY
which services requests from many other hosts, called Clients.
U
• As an example, a Web Server services requests from many browsers
VT
running on Client hosts.
• It responds by sending the requested object.
.IN
• Since it is always on, and since it services many requests, the address is
C
fixed for quick access.
N
• Common applications using this architecture include the Web, FTP, email.
SY
• Often, a single server is incapable of handling the volume of requests.
U
• There are multiple servers housed in a data centre.
VT
• Further, there could be multiple data centres spread across the globe.
• Google (search engine) has 19 data centres across the globe.
.IN
• The application exploits direct communication between pairs of intermittently
C
connected hosts, called peers.
N
• These peers are not owned by the service provider but instead are desktops
SY
and laptops owned by the end users (in homes and offices).
U
• A popular P2P application is the file-sharing application (BitTorrent, InShare,
VT
Zapya, etc).
• This architecture is distributed, scalable and cost effective, since it does not
need server infrastructure (data centres) and server bandwidth.
• Since there are no fixed servers, peers must rely on some method to locate
.IN
fellow peers.
C
• The most basic approach is a centralized directory where resources are
N
indexed on a central server, and peers query this server for a lookup to find
SY
the peer with the desired resource, and then make a connection to the peer.
• BitTorrent uses a centralized directory server, calling it the Tracker.
U
VT
• Note that while resource lookup is still client-server, the actual resource
transmission, which accounts for the bulk of the network capacity usage, is
P2P.
.IN
C
N
SY
U
VT
.IN
both sides that enable the communication (sending and receiving data).
C
• In applications that use the Client-Server architecture, like the Web, the
N
browser on the client is a client process and the one running on the server is
the server process.
SY
• A process sends message into, and receives messages from, the network
U
through a software interface called a socket.
VT
• It is the interface between the Application layer and the Transport layer (in
the TCP / IP Reference model).
• It is also referred to as Application Programming Interface (API).
.IN
C
N
SY
U
VT
.IN
• Two pieces of information are needed here:
C
• The address of the host (IP address);
N
• An identifier that specifies the process on the host (Port number).
SY
• The combination of the above two is the socket address.
U
• Popular applications have been assigned specific Port numbers by IANA:
VT
• Web server – Port number 80
• Mail server (using SMTP protocol) – Port number 25.
N
SY
U
VT
.IN
available Transport layer protocols.
C
• This is done by studying the services provided by those protocols, and choose
N
the one that best suits the needs of the application.
SY
• Like how we choose to travel to a distant place – By our own car, or a bus,
train, plane, etc.
U
• Each one has different pros and cons, and none is the ideal mode of
VT
transport for everyone.
.IN
under the following heads:
• Reliable data transfer
C
• Throughput
N
• Propagation time (delay)
SY
• Security aspects
U
VT
.IN
• Data that is corrupted due to noise should be detected and dealt with;
• Packets are not lost (due to buffer overruns or due to an error in the IP
C
Header);
N
• Packets are not delivered (to the Application) in improper sequence.
SY
• Many applications (Financial transactions, email, remote host access, etc) do
U
not tolerate the data loss mentioned above.
VT
• Some loss-tolerant applications (notably multimedia applications such as
conversational audio / video) can tolerate some amount of data loss.
.IN
receiving process.
C
• The available throughput will fluctuate with time because:
N
• The bandwidth along the network path is shared with other sessions (of
SY
differing throughput needs);
• Sessions come on, get completed and closed at different points in time.
U
• Can an application request a guaranteed throughput from the Transport layer
VT
protocol?
• And does it need such a guarantee?
.IN
absence of the required throughput.
• Many multimedia applications fall in this category, though a few can adjust
C
the coding schemes and settle for a slightly lower throughput.
N
SY
• Bandwidth-elastic applications are those that can make use of as much, or as
little, throughput that is available at the moment.
U
• Email, file transfer, Web transfer fall in this category.
VT
.IN
guarantees.
C
• Interactive real-time applications definitely need such a guarantee.
N
• Eg.: Internet telephony, videoconferencing, multiplayer games, etc.
SY
• Even for non-real-time applications, a lower delay would always be preferable,
though a tight constraint is not placed.
U
VT
.IN
services, like:
• End-to-end encryption;
C
• End-point authentication;
N
• Data integrity (a check to find out if the data has been tampered with).
SY
• Note that the traditional TCP does not provide a facility for the above features.
U
VT
• If they are required, then the application should use an enhanced feature of
TCP, called Transport Layer Security (TLS).
• Note that TLS is not a third protocol (besides TCP and UDP).
• The special TLS code should be used in the application development.
.IN
• When an application uses TLS, the sending process passes cleartext data to
C
the TLS socket.
N
• TLS in the sending host then encrypts the data and passes it on to the TCP
SY
socket.
U
• The reverse happens on the receiver side.
VT
.IN
C
N
SY
U
VT
N
SY
U
VT
.IN
interconnected network of digital information that is accessible through the
internet.
C
• It consists of a collection of web pages, documents, multimedia content, and
N
SY
resources linked together using hyperlinks.
• The web allows users to access, share, publish, and interact with a diverse
U
range of content, including text, images, videos, audio, and interactive
VT
applications.
.IN
in HTML format, that can include text, images, multimedia, and links.
C
• These web pages are grouped together to form websites, which are hosted on
N
web servers and accessible via web browsers.
SY
• Hyperlinks, often called links, are clickable elements within web content that
connect to other web pages, websites, or resources.
U
VT
• Clicking on a hyperlink navigates the user to the linked content, enabling
seamless exploration across the web.
.IN
a specific resource on the web.
C
• URL consists of a protocol (such as HTTP or HTTPS), a domain name (e.g.,
N
[Link]), and a path to the resource.
SY
• Web browsers are software applications used to access and view web content.
They interpret HTML and other web technologies to render web pages in a
U
readable and interactive format for user.
VT
• Web servers are computers that store web content and respond to user
requests by sending the requested web pages and resources back to the
user’s browser.
.IN
transferring data between a web browser and a web server. HTTPS is a secure
version of HTTP that encrypts data to enhance security and privacy during
C
data transmission.
N
SY
• Search engines index web content, making it searchable and discoverable for
users. They use algorithms to rank and present search results based on user
U
queries, enabling efficient access to relevant information.
VT
• Search Engine Optimization (SEO) is the practice of optimizing websites to
improve their visibility in search engine results. By following SEO best
practices, website owners increase the chances of their sites appearing
higher in search rankings.
Computer Networks - Prof Ashok Herur 29
SEO
• When website owners implement the SEO strategies effectively, they send
.IN
signals to search engines that their website is valuable and relevant to specific
search queries.
C
• For example, if a website sells organic skincare products, they would want
N
to optimize their website for keywords related to organic skincare, such as
SY
“natural skincare,” “chemical-free skincare,” or “organic beauty products.”
• By strategically placing these keywords in their website’s content and URLs,
U
the website owner increases the likelihood of their site ranking higher
VT
when users search for those terms.
• Additionally, search engines consider other factors when determining website
visibility, such as the website’s loading speed, mobile-friendliness, and user
experience.
.IN
within an enterprise that stores recently accessed web pages to improve
response time for users when the same content is requested within a certain
C
time after the original request.
N
SY
• Most web browsers also implement a browser cache by writing recently
obtained data to a local data storage device
U
VT
• Enterprise firewalls often cache Web resources requested by one user for the
benefit of many users.
.IN
elements are organized (defines its structure and content) and presented to
the visitors.
C
• CSS (Cascading Style Sheets): CSS is responsible for the visual presentation
N
SY
and layout of a website. It adds style (font, spacing, etc) colour, and aesthetic
appeal to the web pages, making them visually appealing and engaging.
U
• JavaScript: JavaScript enhances the user experience by adding interactivity
VT
and dynamic elements to web pages. It allows websites to respond to user
actions, such as clicking on buttons or scrolling through content.
.IN
distributed, collaborative, information systems like the World Wide Web,
where hypertext documents include hyperlinks to other resources that the
C
user can easily access, for example by a mouse click or by tapping the screen.
N
• HTTP/1 was finalized as version 1.0 in 1996. It evolved (as version 1.1) in 1997.
SY
• Its secure variant named HTTPS is used by more than 85% of websites.
U
• HTTP/2, published in 2015, provides a more efficient version of HTTP/1.
VT
• As of January 2024, it is used by 36% of websites and supported by almost all web
browsers (over 98% of users).
.IN
• The client (process on a browser) submits an HTTP request message to the
C
server.
N
• The server, which provides resources such as HTML files and other content
SY
returns a response message to the client.
U
• HTTP defines the structure of these messages, and how the messages are
VT
exchanged.
• It uses TCP as the transport layer protocol for a reliable, end-to-end transfer.
.IN
time to initiate and transfer the requested web page.
C
• Therefore, in many applications, where the client and the server interact for
N
an extended period of time, the TCP connection is kept “open” for a
SY
(configurable) amount of time.
• This is called Persistent connection (default mode of operation)
U
• On the other hand, in non-Persistent connection mode, a new TCP connection
VT
is opened for each request.
.IN
C
N
SY
U
VT
.IN
return (cr) character (takes to the beginning of a line), followed by a Line feed
(lf) character (takes to next line)
C
• The first line is called the Request line, and subsequent ones are called Header
N
lines.
SY
• The Request line has 3 fields: Method field, the URL field and the HTTP
U
version field.
VT
• The Method field can take on different values, but generally is GET, but can
also be PUT, DELETE, POST, and HEAD.
• The GET method is used when the browser requests something that is identified in the
URL field.
• The PUT method allows an user to upload an object to a specific path on the server.
Computer Networks - Prof Ashok Herur 37
HTTP – Request Message format
.IN
C
N
SY
U
VT
.IN
• The POST method is used when the user fills out a Form with more details for a specific
search (the Entity body is now used to describe the Request in detail, by including key
C
search words).
N
• The HEAD method is used by developers for debugging, wherein the request is responded
SY
with an HTTP message but without the requested object.
U
• The host on which the object resides (for use of Web proxy caches);
VT
• If the connection should be Persistent or Non-persistent;
• The browser type (Chrome, Firefox, Mozilla,..) that is making the request;
• Language preference (if the requested object is available in that language).
.IN
lines.
C
• The Status line indicates the HTTP version (/1, /1.1, /2 or /3), followed by the
N
code and phrase representing the status of the Request (found what was
SY
requested, not found, not found in the specific language, etc).
• The Header part contains details like Time Stamp, Server type (Apache, etc),
U
length of the content (object) in bytes, the content type (Text /HTML, etc), the
VT
Last-modified time, etc.
• The Entity body is a large part of the message and contains the requested
object itself.
.IN
C
N
SY
U
VT
.IN
to a web browser.
• Web browsers store the cookies they receive for a predetermined period of
C
time, or for the length of a user's session on a website.
N
SY
• They attach the relevant cookies to any future requests that the user makes to
the web server.
U
• Cookies help inform websites about the user, enabling the websites to
VT
personalize the user experience.
• For example, ecommerce websites use cookies to know what merchandise users have
placed in their shopping carts.
• In addition, some cookies are necessary for security purposes, such as authentication
cookies.
Computer Networks - Prof Ashok Herur 42
Cookies
• The customer has earlier shopped on
.IN
ebay and has a cookie 8734.
C
Now, when he tries to buy on Amazon
(with a http request), the server creates
N
a cookie 1678 and tells the client
SY
browser to note it down (in a cookie file).
U
VT • All subsequent requests (within a
specified time) will contain this cookie
number in the header line.
N
SY
U
VT
.IN
application layer protocol, to transfer mail from one user to another.
C
• At a high-level view, the Internet email system has 3 major components:
N
• User agents
SY
• Mail servers
• SMTP
U
VT
• Microsoft Outlook, Apple Mail, Web-based Gmail, Gmail app on a smartphone
are some of the popular User Agents.
.IN
the mail to it’s own, always-on server where it is placed in the outgoing
message queue.
C
• When the turn comes up, the message is forwarded to the server of the
N
SY
recipient, using the SMTP protocol (over a TCP connection).
• If it cannot be delivered for any reason, it retries after every 30 minutes.
U
• If it cannot be delivered within a set time (a day or two), the sender is
VT
informed about the inability to deliver the message.
• When delivered, it is stored in the mailbox of the recipient (like a mailbox
in the physical Post Office).
.IN
C
N
SY
U
VT
.IN
from the mailbox in his / her server, using one of the following protocols:
• the earlier POP (Post Office Protocol), or
C
• the newer IMAP (Internet Message Access Protocol), or
N
• HTTP (when the recipient is using a web-based email or a smartphone app)
SY
• When POP is used, the recipient can choose to keep a copy or to delete it
U
from the server after it is downloaded.
VT
• Further, the mail server can only be accessed from one device.
• However, in the case of IMAP, the copy is always maintained for some
management functions, and can be accessed from multiple devices.
N
SY
U
VT
.IN
• Which one is more useful? And where?
C
• Just like humans, hosts on the Internet are also identified by a human-friendly
N
Hostname (of variable length) like [Link], but that will not provide
SY
any information about where the host is located within the Internet.
• DNS is the “Internet’s Directory Service” that provides the location (IP
U
address) of the host for the transfer of the request or of the information.
VT
• Routers effectively forward the packets using the fixed-length, hierarchical
IP address.
.IN
• A distributed database implemented in a hierarchy of DNS servers;
• An Application layer protocol that allows hosts to query the database;
C
• Also used by other Application layer protocols like HTTP and SMTP to translate
N
user-supplied host names to IP addresses.
SY
• A simple design for DNS would have just one DNS server that contains all the
U
mappings; The problems here would be: VT
• Risk of failure of the server – everything crashes.
• Huge traffic volume.
• Distance between the querying host and the server.
• Maintenance – Updating changes to the allocated IP addresses.
.IN
servers organised in a hierarchical fashion and distributed across the world.
• No single DNS server has all the mappings for all of the hosts in the
C
N
internet.
SY
• Broadly, there are 3 classes of DNS servers:
• Root DNS servers;
U
VT
• Top-level domain (TLD) DNS servers;
• Authoritative DNS servers.
.IN
C
N
SY
U
VT
.IN
hostname (say, [Link]), it contacts one of the nearest Root DNS
servers (there are more than 1000 of them scattered across the world, and
C
managed by 12 different organisations, coordinated by IANA.
N
SY
• The Root DNS server returns the IP addresses of the TLD servers for the top-
level domain <.com>, which returns the IP addresses of an authoritative
U
server for [Link]. This, in turn, returns the IP address for the host name
VT
www. [Link]
• The top-level domains - .com, .edu, .org, .gov, and all the country level
domains like .in, .uk, .fr, there is a TLD server (or a cluster of them).
.IN
a hostname to an IP address, it stores that in its local memory.
• This is called DNS caching.
C
N
• When another query, for the same hostname, arrives at the DNS server, it can
SY
provide the desired IP address immediately.
U
• Since the mapping is not permanent, the cache is cleared (and updated)
VT
regularly.
• The DNS server can also cache the IP addresses of TLD servers, thereby
allowing it to bypass the Root DNS servers (in the query chain).
.IN
• SSH is "secure" because it incorporates encryption and authentication via a
C
process called Public key cryptography.
N
• Public key cryptography is a way to encrypt data, or sign data, with two
SY
different keys.
• One of the keys, the public key, is available for anyone to use.
U
• The other key, the private key, is kept secret by its owner.
VT