Application Layer - 02
Application Layer - 02
Client (Browser):
A variety of vendors offer commercial browsers that interpret and display a
Web document, and all use nearly the same architecture.
Each browser usually consists of three parts: a controller, client protocol, and
interpreters.
The controller receives input from the keyboard or the mouse and uses the
client programs to access the document. After the document has been
accessed, the controller uses one of the interpreters to display the document on
the screen.
Server
The Web page is stored at the server. Each time a client request
arrives, the corresponding document is sent to the client.
To improve efficiency, servers normally store requested files in a
cache in memory; memory is faster to access than disk.
A server can also become more efficient through multithreading or
multiprocessing. In this case, a server can answer more than one
request at a time.
A client that wants to access a Web page needs the address. To
facilitate the access of documents distributed throughout the world,
HTTP uses locators..
Uniform Resource Locator (URL)
A web page, as a file, needs to have a unique identifier to differentiate it
from other web pages.
To define a web page, we need four identifiers in general: Protocol, host,
port, and path.
Protocol: Which client-server application we are using is called protocol.
Although most of the time the protocol is HTTP (Hyper Text Transfer
Protocol), we can also use other protocols such as FTP (File Transfer
Protocol).
Host: The host identifier can be the IP address of the server or the unique
name to the server.
Port: The port, a 16-bit integer, is normally predefined for the client-server
application.
Cookies
Cookies enable stateful interactions on the World Wide Web, allowing websites
to remember users and their activities, such as login status or items in a shopping
cart.
Upon a client's request, the server creates a cookie containing user information
and sends it back to the client; the client's browser stores this cookie.
During subsequent interactions, the client's browser sends the stored cookie back
to the server, allowing the server to recognize returning clients and provide a more
personalized experience.
Maintaining user/server state: cookies
Recall: HTTP GET/response interaction is stateless
No notion of multi-step exchanges of HTTP messages to complete a Web
“transaction”
No need for client/server to track “state” of multi-step exchange
All HTTP requests are independent of each other
No need for client/server to “recover” from a partially-completed-but-never-completely-
completed transaction.
A stateful protocol: client makes two changes to X, or none at all.
Maintaining user/server state: cookies
Maintaining user/server state: cookies
Web sites and client browser use cookies to maintain some state between
transactions.
Four components:
1. Cookie header line of HTTP response message
2. Cookie header line in next HTTP request message
3. Cookie file kept on user’s host, managed by user’s browser
4. Back-end database at Web site
Example:
Susan uses browser on laptop, visits specific e-commerce site for first time
When initial HTTP requests arrives at site, site creates:
Unique ID (aka “cookie”)
Entry in backend database for ID
Subsequent HTTP requests from Susan to this site will contain cookie ID value,
allowing site to “identify” Susan
Cookies: tracking a user’s browsing behavior
Cookies can be used to:
Track user behavior on a given website (first party cookies)
Track user behavior across multiple websites (third party cookies) without
user ever choosing to visit tracker site (!)
Tracking may be invisible to user:
Rather than displayed ad triggering HTTP GET to tracker, could be an
invisible link
Third party tracking via cookies:
Disabled by default in Firefox, Safari browsers
To be disabled in Chrome browser in 2023
HTTP
The Hypertext Transfer Protocol (HTTP) is a protocol used mainly to access data
on the World Wide Web. The Hyper Text Transfer Protocol (HTTP) is used to
define how the client-server programs can be written to retrieve web pages from
the Web.
HTTP uses the services of TCP on well-known port 80, the client uses a
temporary port number.
It is a connection-oriented and reliable protocol.
HTTP functions as a combination of FTP and SMTP.
Other HTTP request messages
POST method:
Web page often includes form input
User input sent from client to server in entity body of HTTP POST request message.
GET method (for sending data to server):
Include user data in URL field of HTTP GET request message (following a ‘?’).
HEAD method:
Requests headers (only) that would be returned if specified URL were requested with an
HTTP GET method.
PUT method:
Uploads new file (object) to server
Completely replaces file that exists at specified URL with content in entity
body of POST HTTP request message.
Non Persistent versus Persistent Connections
Nonpersistent Connections:
In a nonpersistent connection, one TCP connection is made for each
request/response. The following lists the steps in this strategy:
The client opens a TCP connection and sends a request.
The server sends the response and closes the connection.
The client reads the data until it encounters an end-of-file marker; it then closes the
connection.
For example: If a file contains links to N different pictures in different files (all
located on the same server), the connection must be opened and closed N + 1 times.
Disadvantage: The nonpersistent strategy imposes high overhead on the
server because the server needs N + 1 different buffer each time a
connection is opened.
Persistent Connections
HTTP version 1.1 specifies a persistent connection by default.
In a persistent connection, the server leaves the connection open
for more requests after sending a response.
The server can close the connection at the request of a client or if
a time-out has been reached.
Advantages:
Time and resources are saved using persistent connections.
Only one set of buffers and variables needs to be set for the
connection at each site.
The round-trip time for connection establishment and connection
termination is saved.
Persistent Connections
It is important to know that HTTP is a stateless protocol as:
HTTP server does not maintain any state. It forgets about the client after
sending the response.
It treats every new request independently.
HTTP Security:
HTTP per se does not provide security.
HTTP can be run over the Secure Socket Layer (SSL). In this case, HTTP is
referred to as HTTPS.
HTTPS provides confidentiality, client and server authentication, and data
integrity.
DNS
As we know human beings are not comfortable in remembering
numbers so to remember IP address of a website or mail account in
internet is difficult. Secondly IP addresses of mail or websites keeps
on changing, so we have to come up with one more level of addressing
which is easy to remember and do not change with time.
Solution is Name addressing, i.e. we give some names to websites
and mail account like we do to humans in real world. But then if
someone write a name of the website in the browser, we need some
mechanism to convert it back into IP address.
Domain Name System solve this problem.
DNS
This diagram perfectly represent how DNS works, A user of a website may know
the name of the website; however, the IP protocol needs the IP address.
The DNS client program sends a request to a DNS server to map the Web-site
address to the corresponding IP address.
DNS: a distributed, hierarchical database
Client wants IP address for www.amazon.com; 1st approximation:
client queries 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
Hierarchy of Name Servers
Root name servers:
It is contacted by name servers that cannot resolve the name. It
contacts confident name server if name mapping is not known. It
then gets the mapping and return the IP address to the host.
Top level server:
It is responsible for com, org, edu etc and all top-level country
domains like uk, fr, ca, in etc. They have info about confident
domain servers and know names and IP addresses of each confident
name server for the second level domains.
Hierarchy of Name Servers
Confident name servers:
This is organization's DNS server, providing confident hostname to IP mapping for
organization servers. It can be maintained by organization or service provider. In order to
reach cse.dtu. in we have to ask the root DNS server, then it will point out to the top-level
domain server and then to confident domain name server which actually contains the IP
address.
So, the authoritative domain server will return the associative ip address.
Hierarchical Name Space
Name Space:
To be unambiguous, 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.
Flat Name Space:
In a flat name space, a name is assigned to an address. A name in this space is
a sequence of characters without structure.
The main disadvantage of a flat name space is that it cannot be used in a large
system such as the Internet because it must be centrally controlled to avoid
ambiguity and duplication.
So, Solution is Hierarchical Name Space.
Name Space
Hierarchical Name Space:
In a hierarchical name space, each name is made of several parts. The first part
can define the nature of the organization.
The second part can define the name of an organization.
The third part can define departments in the organization, and so on.
In this case, the authority to assign and control the name spaces can be
decentralized. A central authority can assign the part of the name that defines the
nature of the organization and the name of the organization.
The responsibility of the rest of the name can be given to the organization itself.
The management of the organization need not worry that the prefix chosen for a
host is taken by another organization because, even if part of an address is the
same, the whole address is different.
Hierarchy of Name Servers
Generic domain.com (commercial) .edu(educational) .mil(military).org (non-profit
organization) .net (similar to commercial) all these are generic domain.
Country domain: in (PK) .us .uk.
Inverse domain if we want to know what is the domain name of the website. Ip to domain name
mapping. So, DNS can provide both the mapping for example to find the ip addresses of
www.cu.edut.com then we have to type nslookup www.cu.edut.com.
Hierarchy of Name Servers
To have a hierarchical name space, a domain name space was designed. In this design the names
are defined in an inverted-tree structure with the root at the top. The tree can have only 128 levels:
level 0 (root) to level 127.
Label
Each node in the tree has a label, which is a string with a maximum of 63
characters.
The root label is a null string (empty string).
DNS requires that children of a node (nodes that branch from the same node)
have different labels, which guarantees the uniqueness of the domain names.
Label
Domain Name:
Each node in the tree has a domain name. A full domain name is a
sequence of labels separated by dots (.).
The domain names are always read from the node up to the root. The
last label is the label of the root (null). This means that a full domain
name always ends in a null label, which means the last character is a
dot because the null string is nothing.
Telnet
Telnet (Telecommunication Network):
Telnet is a text-based protocol used for remote access to servers,
operating on TCP port 23 and following a client-server model, but
lacks data encryption.
Although useful for debugging and interactive sessions, its lack of
security measures makes it subject to snooping and unsuitable for
transmitting sensitive information.
Largely replaced by more secure alternatives like SSH, Telnet still
finds use in legacy systems and specialized applications where high
security is not crucial
Telnet
ARPANET
ARPANET (Advanced Research Projects Agency Network):
ARPANET was the first wide-area network using packet
switching, created in the late 1960s by the U.S. Department of
Defense, and it laid the groundwork for today's internet.
It introduced early networking protocols like NCP, gave rise to
applications like email, and was designed for research and resource
sharing, expanding to connect hundreds of institutions over time.
Though decommissioned in 1990, its technologies and concepts
had a lasting impact, inspiring subsequent networks and internet
protocols, but initially lacked strong security measures.
ARPANET
X.25
X.25 is an old protocol for wide area networks that includes features for error checking, virtual
circuit setup, and usage-based billing, operating across three layers of the OSI model.
It was widely used in the past for applications like credit card processing and ATMs, supporting
slower data rates initially but evolving over time.
Although its usage has declined due to faster protocols like IP, it inspired newer technologies like
Frame Relay and ATM and was a backbone for international data services before the Internet.
SNMP
Simple Network Management Protocol (SNMP):
SNMP is a common tool for managing and monitoring network
devices; it operates over UDP (User Datagram Protocol) and
interacts with databases known as MIBs (Management Information
Bases) to control device properties.
It works on a client-server model with an SNMP manager and
agents, supports various operations like GET, SET, and TRAP, and
comes in different versions with varying security features.
It's scalable and used for real-time monitoring, collecting data
either by polling from the manager to the agent or trapping where
the agent notifies the manager about specific events.
SNMP
SNMP
Voice over IP:
VoIP allows for versatile communication, including voice calls and
multimedia, over IP networks, offering cost savings and network efficiency.
Relies on a stable internet connection and computer hardware; any disruption
can affect the telephone service.
Susceptible to delays, security risks, and challenges in routing emergency
calls due to the nature of IP networks.
Remote Procedure Call
Remote Procedure Call (RPC) allows programs to execute procedures (functions) on a remote
server, as if they were local, facilitating distributed computing.
Operates over various transport protocols such as TCP or HTTP and may include authentication
and encryption features for secure communication.
Often used in client-server architectures and distributed systems, but can introduce complexities
like network latency and failure handling.
Firewall
Firewalls act as security guards for network traffic, checking data
packets and allowing or blocking them based on set rules like IP
addresses and port numbers.
They offer different features like Stateful Inspection, Proxy Services,
and VPN Support to enhance security measures, some even include
intrusion detection systems.
Types of firewalls range from hardware versions that are separate
devices to software ones installed on individual computers, and they
often come with logging and reporting features for network
monitoring.
Firewall
Repeater
Repeaters boost the strength of a signal as it travels through a
communication channel, like a telephone line or a radio frequency, to
help it cover longer distances.
In situations where signals lose power due to resistance or distance, a
repeater amplifies the signal before sending it further.
In computer networking, repeaters operate on the physical layer of
the OSI model, as they only work with the actual signal and don't
interpret data.
Repeater
Repeater
Repeaters are used to extend transmissions so that the signal can cover longer
distances or be received on the other side of an obstruction.
In computer networking, because repeaters work with the actual physical signal,
and do not attempt to interpret the data being transmitted, they operate on the
physical layer, the first layer of the OSI model.
Hub
Hubs are multiport repeater. An Ethernet hub, active hub, network hub, repeater hub, multiport
repeater, or simply hub is a network hardware device for connecting multiple Ethernet devices
together and making them act as a single network segment.
It has multiple input/output (I/O) ports, in which a signal introduced at the input of any port
appears at the output of every port except the original incoming. A hub works at the physical layer
(layer 1) of the OSI model. Hubs are now largely obsolete, having been replaced by network
switches except in very old installations.
Bridge
Bridge is used to connect two different lan. A network bridge is a computer networking device
that creates a single, aggregate network from multiple communication networks or network
segments. Bridging connects two separate networks as if they were a single network.
In the OSI model, bridging is performed in the data link layer (layer 2).
Switch
A network switch connects multiple devices on a network and uses MAC addresses to send data
directly to the right device.
Unlike simpler devices like repeater hubs that send data to all ports, a switch is smarter and only
sends data to the specific device it's meant for.
The most common type of switch is for Ethernet networks, and the first one was made by Kalpana
in 1990.
Router
A router moves data between different computer networks, directing it based on destination
information.
It checks a data packet's header to know where to send it next, using its own set of rules or a
"routing table.“
Simple routers are used in homes, while more advanced ones are for big businesses and internet
service providers.
Gateway
A gateway is a piece of networking hardware or software used in
telecommunications for telecommunications networks that allows data
to flow from one discrete network to another.
Gateways are distinct from routers or switches in that they
communicate using more than one protocol to connect multiple
networks and can operate at any of the seven layers of the open
systems interconnection model (OSI).
The term gateway can also loosely refer to a computer or computer
program configured to perform the tasks of a gateway, such as a
default gateway or router.
Gateway
Any Question?