Unit 5-Application Layer Protocols-1
Unit 5-Application Layer Protocols-1
Total Marks-20
• The Application Layer is topmost layer in the Open System Interconnection (OSI)
model.
• This layer provides several ways for manipulating the data (information) which
actually enables any type of user to access network with ease.
• This layer also makes a request to its bottom layer, which is presentation layer for
receiving various types of information from it.
• The Application Layer interface directly interacts with application and provides
common web application services. This layer is basically highest level of open
system, which provides services directly for application process.
• Functions of Application Layer:
1. Application Layer provides a facility by which users can forward several emails and it also
provides a storage facility.
2. This layer allows users to access, retrieve and manage files in a remote computer.
3. It allows users to log on as a remote host.
4. This layer provides access to global information about various services.
5. This layer provides services which include: e-mail, transferring files, distributing results
to the user, directory services, network resources and so on.
6. It provides protocols that allow software to send and receive information and present
meaningful data to users.
7. It handles issues such as network transparency, resource allocation and so on.
8. This layer serves as a window for users and application processes to access network
services.
9. Application Layer is basically not a function, but it performs application layer functions.
10. The application layer is actually an abstraction layer that specifies the shared protocols
and interface methods used by hosts in a communication network.
• Functions of Application Layer:
12. This layer allows users to interact with other software applications.
13. In this layer, data is in visual form, which makes users truly understand data
rather than remembering or visualize the data in the binary format (0’s or 1’s).
14. This application layer basically interacts with Operating System (OS) and thus
further preserves the data in a suitable manner.
15. This layer also receives and preserves data from it’s previous layer, which is
Presentation Layer (which carries in itself the syntax and semantics of the
information transmitted).
16. The protocols which are used in this application layer depend upon what
information users wish to send or receive.
5.1.1 World Wide Web(WWW):
• The World Wide Web (WWW) is a collection of documents and other web
resources which are identified by URLs, interlinked by hypertext links, and can be
accessed and searched by browsers via the Internet.
• Website is a collection of web pages belonging to a particular organization.
• The pages can be retrieved and viewed by using browser.
• World wide web provides flexibility, portability, and user-friendly features.
• It mainly consists of a worldwide collection of electronic documents (i.e, Web
Pages).
• It is basically a way of exchanging information between computers on the
Internet.
• The WWW is mainly the network of pages consists of images, text, and sounds on
the Internet which can be simply viewed on the browser by using the browser
software.
5.1.1.1 Basic Terminologies in WWW:
1. Web page - a single page or a document on the web (a "homepage" is the first
web page on a web site).
3. URL (Uniform Resource Locator) - a web address; indicates the location of a web
resource as well as the protocol needed to access it
6. Web server - the computer or network of computers which stores web pages
5.1.1.2 Types of Web Documents
• The documents in the World Wide Web can be grouped into three categories
static documents, dynamic documents and active documents.
• These categories are based on the time the contents of the document are
determined.
1. Static Documents
• The documents that contain fixed content is called as a static document.
• Static documents are created and stored on the server. The client can get a copy
of the documents only.
• In other words, we can say that the content of the file is determined when the file
is created, not when it is used.
• Static documents, user cannot change the content, but the content server can be
changed. When the client access the document, a copy of the documents is the
sent, the user can then use a browsing program to display the documents.
5.1.1.2 Types of Web Documents (Continue…..)
• Static documents are prepared using one of the languages which are mentioned
below:
• HTML (Hypertext Markup Language)
• XML (Extensible Markup Language)
• XHTML (Extended Hypertext Markup Language)
• XSL (Extensible Style Language)
2. Dynamic Documents
• Dynamic documents are created by a web server when the browser requests the
document.
• When server receives the request, it runs an application program or script which
creates the dynamic documents. The server returns the output of the program or
script as a response to the browser that requested the documents.
• A fresh document is created for each request; the content for dynamic documents
may vary from one request to another.
5.1.1.2 Types of Web Documents (Continue…..)
• For example, when we retrieve the date and time from the web server, the result
differs for each request. This is because the date and time are dynamic as they
change from moment to moment. A client can ask the client to date the program
in Unix and send the result of the program to the client. CGI (Common Gateway
Interface) is a technology used to create and handle the dynamic documents.
• CGI:
• It is a set of standards that defines how the content in dynamic documents is
written, how the data are input into the program, and how it is shown. It allows
programmers to use languages such as C, A clientorn shell, or Perl.
• Common gateway interface represents the standard that defines a common set of
rules for any language or platform. C represents ms can also be used to access the
other resources like database, graphic, etc.
5.1.1.2 Types of Web Documents (Continue…..)
• There are some predefined terms and variables which can be used in Common
gateway interface programs.
• A CGI program is a code which is written in one of the languages that CGI
supports.
• The programmer who knows how to encode the sequence of action or task in the
program, and has a knowledge of syntax, can write a CGI program.
• Dynamic documents sometimes referred to as server site dynamic documents.
5.1.1.2 Types of Web Documents (Continue…..)
3. Active Documents
• For many applications, we need a program or script to be run at the client site. These are
called as active documents.
• For example, suppose we want to run a program that creates animation graphics on the
screen. Definitely, the program needs to be run at the client site where animation action
takes place.
• When a browser requests an active document, the server sends a copy of the script or
document; then, the document is run at the client.
• Java Applets:
• Java applets are used to create an active document. Java is a high level, an object-
oriented programming language which allows a programmer to write an active
document and browser to run it. I
• An applet is a program which is written in java on the server. It is compiled and ready to
5.1.1.2 Types of Web Documents (Continue…..)
• The document is always in binary format. The client first creates an instance of this
applet and then run it.
• The browser can run Java applets in two ways; one way is the browser directly
request a java applet program in URL and receives the applet in binary format, the
another way is browser can retrieve and run HTML file that has embedded the
applet’s address as a tag.
• JavaScript:
• Active documents use the idea of scripts. We can also use JavaScript to create and
active documents.
__________________________________________________________________
• Now we will see the components of WWW in detail.
5.1.1.4 .Client/Browser
• The Client/Web browser is basically a program that is used to communicate
with the webserver on the Internet.
5.1.1.3 WWW Architecture:
• Each browser mainly comprises of three components and these are:
– Controller
– Interpreter
– Client Protocols
• The Controller mainly receives the input from the input device, after that it
uses the client programs in order to access the documents.
• After accessing the document, the controller makes use of an interpreter in
order to display the document on the screen.
• An interpreter can be Java, HTML, javascript mainly depending upon the type
of the document.
• The Client protocol can be FTP, HTTP, TELNET.
5.1.1.3 WWW Architecture:
• Browser architecture is as follows:
5.1.1.3 WWW Architecture:
5.1.1.5. Server
• The Computer that is mainly available for the network resources and in order to provide
services to the other computer upon request is generally known as the server.
• The Web pages are mainly stored on the server.
• Whenever the request of the client arrives then the corresponding document is sent to
the client.
• The connection between the client and the server is TCP.
• It can become more efficient through multithreading or multiprocessing. Because in this
case, the server can answer more than one request at a time.
5.1.1.6. URL
• URL is an abbreviation of the Uniform resource locator.
• It is basically a standard used for specifying any kind of information on the Internet.
• In order to access any page the client generally needs an address.
• To facilitate the access of the documents throughout the world HTTP generally makes
use of Locators.
5.1.1.3 WWW Architecture:
• URL mainly defines the four things:
ii) Host Computer It is the computer on which the information is located. It is not
mandatory because it is the name given to any computer that hosts the web
page.
iii) Port The URL can optionally contain the port number of the server. If the port
number is included then it is generally inserted in between the host and path and
is generally separated from the host by the colon.
iv) Path It indicates the pathname of the file where the information is located.
5.1.1.3 WWW Architecture:
5.1.1.7. HTML
• HTML is an abbreviation of Hypertext Markup Language.
• Working-
HTTP uses a client-server model where-
• Web browser is the client.
• Client communicates with the web server hosting the website.
5.1.2. Hypertext Transfer Protocol (HTTP)(Continued…..)
• Whenever a client requests some information (say clicks on a hyperlink) to the
website server.
• The browser sends a request message to the HTTP server for the requested
objects. Then-
• HTTP opens a connection between the client and server through TCP.
• HTTP sends a request to the server which collects the requested data.
• HTTP sends the response with the objects back to the client.
• HTTP closes the connection.
5.1.2.1HTTP Connections-
HTTP connections can be of two types-
• Non-persistent HTTP connection
• Persistent HTTP connection
5.1.2. Hypertext Transfer Protocol (HTTP)(Continued…..)
Non-persistent HTTP connections Persistent HTTP Connections
1. Non-persistent HTTP connection is one that 1. Persistent HTTP connection is one that can
is used for serving exactly one request be used for serving multiple requests.
and sending one response.
2. HTTP server closes the TCP connection 2. HTTP server closes the TCP connection only
automatically after sending a HTTP when it is not used for a certain
response. configurable amount of time.
3. A new separate TCP connection is used for 3. A single TCP connection is used for sending
each object. multiple objects one after the other.
4. HTTP 1.0 supports non-persistent 4. HTTP 1.1 supports persistent connections by
connections by default. default.
Example- Example-
• Suppose a request has been made for a • Suppose a request has been made for a
HTML page that contains 10 images HTML page that contains 10 images
(called objects). (called objects).
Then, Then,
• With non-persistent connection, all the • With persistent connection, all the 11
11 objects (1 page + 10 images) will be objects (1 page + 10 images) will be sent
sent one by one. one after the other using a single TCP
• For getting each object, a new separate connection.
connection will be opened and used.
5.1.2. Hypertext Transfer Protocol (HTTP)(Continued…..)
Important Notes-
1. HTTP uses TCP at the transport layer.
This is because-
• Unlike UDP, it guarantees the delivery of data via a Three-way handshake.
• It ensures the re transmission of lost packets.
• HTTP does not have any inbuilt facility for providing reliability.
• So, if HTTP uses UDP, then it will have to maintain or handle the session on its
own.
• For example- If a packet gets lost, then HTTP will have to re-transmit the packet.
Important Notes-
3. HTTP 1.0 is non-persistent and HTTP 1.1 is persistent.
This is because-
• After serving the single HTTP request, the connection is closed and it is not used
again. So, HTTP 1.0 without connection keep alive is connectionless.
Important Notes-
6. HTTP is a stateless protocol.
This is because- HTTP server does not maintain any state.
• It forgets about the client after sending the response.
• It treats every new request independently.
• HTTP closes the connection automatically after generating the response for each
request.
• This ensures that no client can engage connection with web server for a long time.
1. Request Message
2. Response Message
• Figure: Format of Request and Response Message
5.1.2.2 HTTP Transaction/ Messages:
a) Request Type
• This field is used in the request line. The are several request types that are
defined and these are mentioned in the table given below;
b) URL
• URL is a Uniform Resource locator and it is mainly a standard way of specifying
any kind of information on the Internet.
c) HTTP Version
• The current version of the HTTP is 1.1.
d) Status Code
• The status code is the field of the response message.The status code consists of
three digits.
e) Status Phrase
• This field is also used in the response message and it is used to explain the status
code in the form of text.
5.1.2.2 HTTP Transaction/ Messages:
ii) Header
• The header is used to exchange the additional information between the client and the
server. The header mainly consists of one or more header lines. Each header line has a
header name, a colon, space, and a header value.
• The header line is further categorized into four:
a) General Header It provides general information about the message and it can be
present in both request and response.
b) Request Header It is only present in the request message and is used to specify the
configuration of the client and the format of the document preferred by the client
c) Response Header This header is only present in the response header and mainly
specifies the configuration of the server and also the special information about the
request.
d) Entity Header It is used to provide information about the body of the document.
5.1.2.2 HTTP Transaction/ Messages:
iii) Body
• It can be present in the request message or in the response message. The body
part mainly contains the document to be sent or received.
5.2.1 File Transfer Protocol (FTP)
• Purpose-
• It is used for exchanging files over the internet.
• It enables the users to upload and download the files from the internet.
• FTP establishes two TCP connections between the client and the server.
• One connection is used for transferring data.
• Other connection is used for transferring control information.
5.2.1 File Transfer Protocol (FTP) (Continue……)
5.2.1.1 Characteristics of FTP-
• FTP uses TCP at the transport layer.
• FTP uses port number 21 for control connection.
• FTP uses port number 20 for data connection.
• FTP uses persistent TCP connections for control connection.
• FTP uses non-persistent connections for data connection.
• FTP is a connection oriented protocol.
• FTP is an out-of-band protocol as data and control information flow over different
connections.
• FTP is a stateful protocol.
5.2.1 File Transfer Protocol (FTP) (Continue……)
Important Notes-
1. Emails can’t be sent using FTP.
This is because-
• FTP requires the connection establishment between the client and server before
transferring the files. So, both have to be online at the same time.
• That is why, emails are not sent using FTP.
2. FTP can transfer one file at a time.
• FTP is used for transferring one file at a time in either direction between the client
and the server.
3. FTP is a stateful protocol.
• This is because-
• The client establishes control connection for the duration of an FTP session.
• It typically spans multiple data transfers. So, FTP is a stateful protocol.
5.2.1.2 Architecture of FTP:
• Control connection
• For sending control information like user identification, password, commands to
change the remote directory, commands to retrieve and store files, etc., FTP
makes use of a control connection.
• Data connection
• For sending the actual file, FTP makes use of a data connection.
• FTP Session :
• When an FTP session is started between a client and a server, the client initiates a
control TCP connection with the server-side. The client sends control information
over this.
• When the server receives this, it initiates a data connection to the client-side. Only
one file can be sent over one data connection. But the control connection remains
active throughout the user session.
• As we know HTTP is stateless i.e. it does not have to keep track of any user state. But
FTP needs to maintain a state about its user throughout the session.
1. File Structure – In file structure, there is no internal structure and the file is
considered to be a continuous sequence of data bytes.
• FTP Commands: During this communication, the commands are sent fro the
client to server and responses are sent from the server to client.
Sr. No. Command Meaning
• File transfer takes place over the data connection and the commands are sent over the
control connection. The commands supervise the data transfer,
• File transfer in FTP means one of the following:
1. Retrieving a file: Server copies a file onto a client.(Download)
2. Storing of a file: A file can be copied from client to the server.(Upload)
3. Server sends a list of directory or file names to the client. FTP treats such a list of
directory also as a file.
• Here is how a typical FTP transfer works:
Step 1: A user typically needs to log on to the FTP server, although some servers make some
or all of their content available without a login, a model known as anonymous FTP.
Step 2: The client initiates a conversation with the server when the user requests to
download a file.
Step 3:Using FTP, a client can upload, download, delete, rename, move and copy files on a
server.
5.2.1.4 Transmission Modes of FTP:
• For transforming files across the internet connection, it uses three transmission modes.
1. Stream Mode
2. Block Mode
3. Compressed Mode
1. Stream Mode
• In this mode, data transforms from FTP to TCP in the form of stream bytes. Here
TCP is responsible for fragmenting data into small segments. If transforming data
are already in the form of stream bytes, then the data connection is
automatically closed. Otherwise, it is closed by the sender.
2. Block Mode
• Block mode transforms data from one host to another in the form of blocks. Each
block is preceded by a 3-byte header. The first byte contains all the information
about the block hence know for the description block. Other two blocks
containing the size of the block in the form of bytes.
5.2.1.4 Transmission Modes of FTP: (Continue……)
3. Compressed Mode
• Compress mode is used in the case of big file size. If the file size is big, it cannot send over
the internet connection because of the size limit. In Compressed mode, a large file is
compressed into a small size and then sends over the internet.
1. ASCII File: This is the default format for transforming a file from one to another. Each
character is encoded by NVT ASCII, i.e. Network Virtual Terminal ASCII character set. Both
the sender and the receiver transform their file from its own representation into NVT
ASCII.
2. EBCDIC File: If sender or receiver connections use the EBCDIC encoding method, then for
transforming files, FTP uses EBCDIC encoding.
3. Image File: For transforming the binary file, the image file is the default mode. The file is
transformed over the internet connections in the form of stream bits without encoding.
5.2.2 TFTP (Trivial File Transfer Protocol)
• Trivial File Transfer Protocol is a simple protocol that is used for sending a file
from the server to the client.
• Trivial File Transfer Protocol uses the concept of UDP to share files between
server and client.
• TFTP does not apply any security mechanism while filing communication. Since
TFTP does not follow any authentication mechanism or any security mechanism,
it could not be used over the internet to communicate files.
• It is generally used for communicating files among machines set up in the local
intranet only.
• TFTP’s most important feature is that it uses a minimal amount of memory; TFTP
could be used to communicate boot files if computers do not have hard disks.
• TFTP generally uses port69; however, the port used for communication could be
defined by used when TFTP is being set up.
5.2.2.1 Types of TFTP Messages:
• There are five types of TFTP message listed below:
1) RRQ 2) WRQ 3) DATA
4) ACK 5) ERROR
1) RRQ message
• RRQ stands for the read request message. The client uses this to create a
connection For reading data from the server SIDE.
2) WRQ message
• WRQ stands for the write request message. The client uses this to create a
connection for writing data from the server SIDE.
3) DATA message
• Both client and server use data messages to send data blocks.
4) ACK message
• ACK stands for Acknowledge message. Both client and server use this ACK to
acknowledge the receipt of the data block.
5) ERROR message
Client and server use ERROR message when a connection between client and
server cannot be established or when some error has occurred during data
transmission. It sends a negative response to the RRQ message or WRQ message.
5.2.2.2 TFTP Connections:
• It uses an RRQ message, WRQ message, ACK message, and ERROR message to
establish connections. While terminating connections, TFTP uses the DATA
message.
1) Connection Establishment
• The process of connection establishment for reading files is different from writing
files.
a) Reading Connection:
• The client sends the RRQ message to establish a connection for reading. This
message contains the name of the file and the transmission mode of the file.
• Once the connection is established, the server sends a positive response with the
DATA message if the server is able to transfer the file.
• Suppose it does not then send a negative response with an ERROR message.
• This is as shown in following figure:( Figure from Techknoweldge)
5.2.2.2 TFTP Connections: (Continue……)
b) Writing Connection:
• The client sends WRQ messages to establish a connection for writing.
• This message contains the name of the file and the transmission mode of the file.
• Once the connection is established, the server sends a positive response with an
ACK message if the server is able to copy the file.
• Suppose it does not then send a negative response with an ERROR message.
• This is as shown in following figure:( Figure from Techknoweldge).
2) Data Transfer:
• The connection is established first. The data transfer begins after that using UDP
services.
• The data file is to be transferred (read or written) is divided into data blocks with
each block except the last one contains 512 bytes of data.
• The last block has number of bytes between 0 and 511 so as to use it for the
connection termination.
5.2.2.2 TFTP Connections: (Continue……)
3) Connection Termination
• After the transmission of the file, the connection must be terminated.
• It does not use a special message to terminate the connection.
• Termination is done by sending the last data block, which is less than 512 bytes.
5.2.2.3 Working of TFTP:
• We will look at the mechanism of how does communication takes place between
a client and a server using TFTP:
a) Normal Situation:
• Since Trivial File Transfer Protocol uses UDP for communicating files, hence it
establishes a connection generally by using port 69
• Once the connection is established, the client generally requests RRQ or WRQ.
Here, RRQ means Read Request, and WRQ stands for Write Request.
• A client generally requests for reading requests if it wants only to read the file
and generated a written request if he wants to write a particular file that exists on
the server.
• Once this is done, then files are communicated in the form of small packets.
• These packets are 512 bytes. The file to be communicated is divided into small
packets, where each packet consists of 512 bytes.
5.2.2.3 Working of TFTP: (Continue…..)
• Once a packet is communicated from server to client, the server waits to receive
an acknowledgement from the client that the packet has been received.
• Once the acknowledgement is received, the server sends the next packet of 512
bytes.
• This is done till the last packet is communicated from server-side to client-side.
• The last packet which is generated for sharing a particular file is always less than
512 bytes. Even if the packets generated are in multiples of 512 bytes, then it
sends an additional packet which is less than 512 bytes so that the client could
understand that it has received the file.
b) What will happen if a Packet is not received on the Client Side?
• When a packet is communicated from server to client, the server starts a timer.
• It waits until this time to receive the acknowledgement from the client side. If the
acknowledgement is not received from the client-side, then the server re-sends
the same packet until its acknowledgement is received. However, if
acknowledgement is received before the timer, then it sends the next packet.
5.2.2.4 Advantages of TFTP
• Components of SNMP:
SNMP's client-server architecture has the three following components:
1. An SNMP manager;
2. An SNMP agent; and
3. A management information base (MIB).
• The SNMP manager acts as the client, the SNMP agent acts as the server and the
MIB acts as the server's database. When the SNMP manager asks the agent a
question, the agent uses the MIB to supply the answer.
5.3 (SNMP) (Continued…..)
• SNMP is so popular that most network devices come pre-bundled with SNMP
agents. To make use of the protocol, however, network administrators must first
change the default configuration settings of their network devices so SNMP
agents can communicate with the network's management system.
• SNMP is part of the original Internet Protocol (IP) suite as defined by the Internet
Engineering Task Force (IETF). Multiple versions of the SNMP protocol exist. The
most recent version, SNMPv3, includes security mechanisms for authentication,
encryption and access control.
5.3(SNMP) (Continued…..)
• SNMP uses a blend of pull and push communications between network devices
and the network management system. The SNMP agent, which resides with the
MIB on a network device, constantly collects status information but will only push
information to the NMS upon request or when some aspect of the network
crosses a pre-defined threshold known as a trap. Trap messages are typically sent
to the management server when something significant, such as a serious error
condition, occurs.
• SNMP also includes an inform message type that enables a network monitoring
tool to acknowledge messages from a device. Inform messages enable the agent
to reset a triggered alert. Network management tools can also use a set message
to make changes to a network device through the SNMP agent. This capability
enables the network manager to make change device configurations in response
to new network events.
5.3 (SNMP) (Continued…..)
These are the network devices and services upon which the agents run.
3. SNMP manager
• The NMS is a software platform that functions as a centralized console to which
agents feed information. The NMS will actively request agents to send updates at
regular intervals. What a network manager can do with that information depends
heavily on how feature-rich the NMS is.
• There are several free SNMP managers available, but they are typically limited in
their capabilities or the number of nodes they can support. At the other end of
the spectrum, enterprise-grade platforms offer advanced features for more
complex networks, with some products supporting up to tens of thousands of
network nodes.
5.3 (SNMP) (Continued…..)
• SNMP Commands:
• Most of the time, SNMP functions in a synchronous model, with communication
initiated by the SNMP manager and the agent sending a response. These
commands and messages, typically transported over UDP or Transmission Control
Protocol/IP (TCP/IP), are known as protocol data units (PDUs).
• Below are common SNMP commands:
1. GET Request: Generated by the SNMP manager and sent to an agent to obtain
the value of a variable, identified by its OID, in an MIB.
2. GETBULK Request: Sent by the SNMP manager to the agent to efficiently obtain a
potentially large amount of data, especially large tables.
5.3 (SNMP) (Continued…..)
3. GETNEXT Request: Sent by the SNMP manager to the agent to retrieve the values
of the next OID in the MIB's hierarchy.
5. RESPONSE: Sent by the agent to the SNMP manager, issued in reply to a GET
Request, GETNEXT Request, GETBULK Request and a SET Request. Contains the
values of the requested variables.
6. SET Request: Sent by the SNMP manager to the agent to issue configurations or
commands.
7. TRAP: An asynchronous alert sent by the agent to the SNMP manager to indicate
a significant event, such as an error or failure, has occurred.
5.3 (SNMP) (Continued…..)
4. The SNMP is basically a core set of operations and it remains the same on all managed
devices. Thus SNMP supports extendibility.
6. It is a lightweight protocol.
• Disadvantages
1. This protocol leads to the reduction of the bandwidth of the network.
2. Access control, authentication, and privacy of data are some largest security issues using
this.
3. SNMP deals with information that is neither detailed nor enough well organized.