0% found this document useful (0 votes)
51 views34 pages

CN Unit 5

Download as doc, pdf, or txt
Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1/ 34

Computer Networks Unit - V Application Layer

UNIT – V
APPLICATION LAYER
Contents :
 Domain name system
o The DNS Name Space
o Domain Resource Records
o Domain Resource Records
 Electronic Mail
o Architecture Services
o SMTP
 World Wide Web
o Architectural Overview
o HTTP
 Streaming audio and video
o Digital Audio
o Digital Video
o Streaming Stored Media
o Streaming Live Media
o Real Time Conferencing

-o0o-

B.Tech III Year II Semester ECE Page 0 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

UNIT-5
APPLICATION LAYER
 Application layer takes data from the user and convert the data in to the APDU by adding application
layer header.
 Services provided by Application Layer:
 Network Security
 Authentication
 Domain Name System
 World Wide Web
 Network Management through SNMP
 File transfer and Access
 e-Mail
 Network Virtual Terminal
 Multimedia

5.1DNS: (Domain Name System)

 The Domain Name System (DNS) is a directory lookup service that provides a mapping between the
name of a host on the Internet and its numerical address.
 The Domain Name System (DNS) is a supporting program that is used by other programs such as e-
mail. a DNS client/server program can support an e-mail program to find the IP address of an e-mail
recipient.
 Four elements comprise the DNS:
 Domain name space: DNS uses a tree-structured name space to identify resources on the
Internet.
 DNS database: Conceptually, each node and leaf in the name space tree structure names a
set of information (e.g., IP address, type of resource) that is contained in a resource record
(RR).The collection of all RRs is organized into a distributed database.
 Name servers: These are server programs that hold information about a portion of the
domain name tree structure and the associated RRs.
 Resolvers: These are programs that extract information from name servers in response to
client requests. A typical client request is for an IP address corresponding to a given domain
name.

B.Tech III Year II Semester ECE Page 1 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: Example of using the DNS service

 Name Space:
 Name space maps each address to a unique name that can be organized in two ways: Flat
Name Space, Hierarchical Name Space
 Flat Name Space:
o In this, a name is assigned to an address. A name in this space is a sequence of
characteristics without Structure.
o The names may or may not have a common section.
o Disadvantage: It cannot be used in a large system such as the internet because it must
be centrally controlled to avoid ambiguity and duplication.
 Hierarchical Name Space:
o In this, each name is made of several parts.
o The first part can define the nature of the organization.
o The second part can define the name of the organization
o The third part can define the departments in the organization and so on.
o A central authority can assign the part of the name that defines the nature of the
organization and the name of the organization.
o The responsibility of the rest of the name can be given to the organization itself. The
organization can add suffixes (or prefixes) to the name to define its host or
resources.
o Domain Name Space:
 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.

B.Tech III Year II Semester ECE Page 2 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: Domain Name Space

 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.
 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.

B.Tech III Year II Semester ECE Page 3 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: Labels and Domain Names

 Fully Qualified Domain Name (FQDN)


 If a label is terminated by a null string, it is called a fully qualified
domain name (FQDN).
 An FQDN is a domain name that contains the full name of a host.
 It contains all labels, from the most specific to the most general, that
uniquely define the name of the host.
 For example, the domain name challenger.ate.tbda.edu. is the FQDN of
a computer named challenger installed at the Advanced Technology
Center (ATC) at De Anza College.
 A DNS server can only match an FQDN to an address. Note that the
name must end with a null label, but because null means nothing, the
label ends with a dot (.).
 Partially Qualified Domain Name (PQDN)
 If a label is not terminated by a null string, it is called a partially
qualified domain name (PQDN).
 A PQDN starts from a node, but it does not reach the root.
 It is used when the name to be resolved belongs to the same site as the
client. Here the resolver can supply the missing part, called the suffix,
to create an FQDN. For example, if a user at the jhda.edu. site wants to
get the IP address of the challenger computer, he or she can define the
partial name challenger
 The DNS client adds the suffix atc.jhda.edu. before passing the
address to the DNS server.
 The DNS client normally holds a list of suffixes. The following can be
the list of suffixes at De Anza College. The null suffix defines nothing.
This suffix is added when the user defines an FQDN.
atc.fhda.edu
fhda.edu
B.Tech III Year II Semester ECE Page 4 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

null

Figure: FQDN and PQDN


 Domain
 A domain is a subtree of the domain name space. The name of the
domain is the domain name of the node at the top of the subtree.
 a domain may itself be divided into domains (or subdomains as they
are sometimes called).

Figure: Domains
 DNS in Internet:
 DNS is a protocol that can be used in different platforms.
 In the Internet, the domain name space (tree) is divided into three different sections: Generic
Domains, Country Domains, and The Inverse Domain.

Figure: DNS in the Internet


 Generic Domain:
o The generic domains define registered hosts according to their generic behaviour.
Each node in the tree defines a domain, which is an index to the domain name space
database

B.Tech III Year II Semester ECE Page 5 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: Generic Domains

Figure: Generic Domain Labels


 Country Domains:
o The country domains section uses two-character country abbreviations (e.g., us for
United States).
o Second labels can be organizational, or they can be more specific, national
designations.
o The United States, for example, uses state abbreviations as a subdivision of us (e.g.,
ca.us.).

B.Tech III Year II Semester ECE Page 6 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: Country Domains


o The address anza.cup.ca.us can be translated to De Anza College in Cupertino,
California, in the United States.

 Inverse Domain:
o The inverse domain is used to map an address to a name.
o For example, when a server has received a request from a client to do a task.
Although the server has a file that contains a list of authorized clients, only the IP
address of the client (extracted from the received IP packet) is listed.
o The server asks its resolver to send a query to the DNS server to map an address to a
name to determine if the client is on the authorized list. This type of query is called
an inverse or pointer (PTR) query.

Figure: Inverse Domain


 DNS MESSAGES:
 DNS has two types of messages: Query and Response. Both types have the same format.
 The query message consists of a header and question records.
B.Tech III Year II Semester ECE Page 7 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

 The response message consists of a header, question records, answer records, authoritative
records, and additional records.

Figure: Query and Response in DNS


The fields in both Query and Response messages are defined as follows
o Header: Both query and response messages have the same header format with some
fields set to zero for the query messages.
 The header is 12 bytes, and its format is

Figure: Header Format


 The identification subfield is used by the client to match the response with
the query. The client uses a different identification number each time it sends
a query. The server duplicates this number in the corresponding response.
 The flags subfield is a collection of subfields that define the type of the
message, the type of answer requested, the type of desired resolution
(recursive or iterative), and so on.
 The number of question records subfield contains the number of queries in
the question section of the message.
 The number of answer records subfield contains the number of answer
records in the answer section of the response message. Its value is zero in the
query message.
 The number of authoritative records subfield contains the number of
authoritative records in the authoritative section of a response message. Its
value is zero in the query message.
 The number of additional records subfield contains the number additional
records in the additional section of a response message. Its value is zero in the
query message.
o Question Section

B.Tech III Year II Semester ECE Page 8 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

 This section consist of one or more question records. It is present on both


query and response messages.
o Answer Section
 This section consist of one or more resource records. It is present only on
response messages. This section includes the answer from the server to the
client (resolver).

o Authoritative Section
 This section consist of one or more resource records. It is present only on
response messages. This section gives information (domain name) about one
or more authoritative servers for the query.
o Additional Information Section
 This section consist of one or more resource records. It is present only on
response messages. This section provides additional information that may
help the resolver.
 TYPES OF RECORDS
 There are two types of records are used in DNS: Question Records and Resource Records.
 The Question Records are used in the question section of the query and response messages.
 The Resource Records are used in the answer, authoritative, and additional information
sections of the response message.
 Question Record
o A question record is used by the client to get information from a server. This contains
the domain name.

Figure: Query Record Format


The fields are defined as follows

 Query Name: This is a variable length field containing a domain name. Each
count byte is a binary value between 0 and 63, count bytes are not ASCII.

Ex:

 Query Type: This is a 2 byte filed containing the type of query. Some query
types are listed below.

Type Mnemonic Description

1 A( Address) Convert a domain name to


B.Tech III Year II Semester ECE Page 9 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

IPv4 address

2 NS(Name Server) IDs authoritative server for a


zone

5 CNAME (Canonical Defines an alias for official


Name) name of a host

12 PTR Convert an IP address to a


domain name

28 AAAA Convert a domain name to


IPv6 address

 Query Class: This is a 2 Byte field specifying the protocol using DNS.
Internet has a value of 1.
 Resource Record
o Each domain name (each node on the tree) is associated with a record called the
resource record. The server database consists of resource records. Resource records
are also what is returned by the server to the client.

Figure:
Resource Record Format

The fields are defined as follows:


 Domain Name: Variable length field containing domain name
 Domain Type: Same as query type field from before but a reduced “Query
type” list
 Domain Class: 2 Byte field specifying the protocol using DNS. Internet has a
value of 1.
 Time to Live: 4 byte field with number of seconds answer is valid. Receiver
can cache this answer for this period of time
 Resource Data Field Length: 2 bytes representing the length of the resource
data field
 Resource Data: Variable length field containing answer to query.

B.Tech III Year II Semester ECE Page 10 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

5.2 e-MAIL:
 One of the most popular Internet services is electronic mail (e-mail).
 At the beginning of the Internet era, the messages sent by electronic mail were short and consisted of
text only; they let people exchange quick memos. Today, electronic mail is much more complex.
 It allows a message to include text, audio, and video. It also allows one message to be sent to one or
more recipients.

 The three main components of e-Mail:


 User Agent,
 Message Transfer Agent, and
 Message Access Agent.

 User Agent:
o It provides service to the user to make the process of sending and receiving a message
easier.

o Services Provided by a User Agent


 A user agent is a software package (program) that composes, reads, replies to,
and forwards messages.
 It also handles mailboxes.

Figure: Services provided by user agent

 Composing Messages
 A user agent helps the user compose the e-mail message to be sent out.
 Most user agents provide a template on the screen to be filled in by the
user. Some even have a built-in editor that can do spell checking,
grammar checking, and other tasks expected from a sophisticated word
processor.
 A user, of course, could alternatively use his or her favorite text editor
or word processor to create the message and import it, or cut and paste
it, into the user agent template.

 Reading Messages
 The second duty of the user agent is to read the incoming messages.
 When a user invokes a user agent, it first checks the mail in the
incoming mailbox.
 Most user agents show a one-line summary of each received mail.
Each e-mail contains the following fields.
1. A number field.
2. A flag field that shows the status of the mail such as new, already
read but not replied to, or read and replied to.
3. The size of the message.
B.Tech III Year II Semester ECE Page 11 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

4. The sender.
5. The optional subject field.
 Replying to Messages
 After reading a message, a user can use the user agent to reply to a
message.
 A user agent usually allows the user to reply to the original sender or to
reply to all recipients of the message. The reply message may contain
the original message (for quick reference) and the new message.
 Forwarding Messages
 Replying is defined as sending a message to the sender or recipients of
the copy.
 Forwarding is defined as sending the message to a third party. A user
agent allows the receiver to forward the message, with or without extra
comments, to a third party.
 Handling Mailboxes
 A user agent normally creates two mailboxes: an inbox and an
outbox.
 Each box is a file with a special format that can be handled by the user
agent.
 The inbox keeps all the received e-mails until they are deleted by the
user.
 The outbox keeps all the sent e-mails until the user deletes them.
 Most user agents today are capable of creating customized mailboxes.
 Sending Mail
 To send mail, the user, through the UA, creates mail that looks very
similar to postal mail. It has an envelope and a message.

Figure: Format of e-Mail


 Envelope: The envelope usually contains the sender and the receiver
addresses.
 Message: The message contains the header and the body. The header
of the message defines the sender, the receiver, the subject of the
message, and some other information. The body of the message
contains the actual information to be read by the recipient.
B.Tech III Year II Semester ECE Page 12 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

 Receiving Mail
 If a user has mail, the UA informs the user with a notice.
 If the user is ready to read the mail. a list is displayed in which each
line contains a summary of the information about a particular message
in the mailbox.
 The summary usually includes the sender mail address, the subject, and
the time the mail was sent or received. The user can select any of the
messages and display its contents on the screen.
 Addresses
 To deliver mail, a mail handling system must use an addressing system
with unique addresses.
 In the Internet, the address consists of two parts:
 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.
 Domain Name: The domain name assigned to each mail
exchanger either comes from the DNS database or is a logical
name.
 Both local part and domain name are separated by an @ sign.

Figure: E-mail address

 MIME (Multipurpose Internet Mail Extension):


o Multipurpose Internet Mail Extensions (MIME) is a supplementary protocol that allows non-
ASCII data to be sent through e-mail.
o MIME transforms non-ASCII data at the sender site to NVT ASCII data and delivers them to
the client MTA to be sent through the Internet.
o The message at the receiving side is transformed back to the original data.
o MIME has a set of software functions that transforms non-ASCII data (stream of bits) to
ASCII data and vice versa, as shown in Figure.

B.Tech III Year II Semester ECE Page 13 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: MIME

o MIME defines five headers that can be added to the original e-mail header section to
define the transformation parameters:
1. MIME-Version
2. Content-Type
3. Content-Transfer-Encoding
4. Content-Id
5. Content-Description

Figure: MIME Header


 MIME-Version: This header defines the version of MIME used.
 Content-Type: This header defines the type of data used in the body of the
message. The content type and the content subtype are separated by a slash.
Depending on the subtype, the header may contain other parameters.
Content Type: <Type, Subtype, Parameters>

 MIME allows seven different types of data.

B.Tech III Year II Semester ECE Page 14 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: Data Types and Sub types of MIME

 Content-Transfer-Encoding: This header defines the method used to


encode the messages into 0s and 1s for transport:
Content-Transfer-Encoding:<Type>

Figure: Content-Transfer-Encoding

 Content-Id This header uniquely identifies the whole message in a multiple-


message environment.
Content ID: id=<Content-id>

 Content-Description: This header defines whether the body is image, audio,


or video.
Content-Description: <description>

 User Agent Types

B.Tech III Year II Semester ECE Page 15 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

There are two types of user agents:


 Command-Driven and
 GUI-based.

 Command-Driven: Command-driven user agents belong to the early days of


electronic mail. A command-driven user agent normally accepts a one-
character command from the keyboard to perform its task.
Ex: a user can type the character r, at the command prompt, to reply to the
sender of the message, or type the character R to reply to the sender and all
recipients.
Some examples of command-driven user agents are mail, pine, and elm.
 GUI-Based: Modem user agents are GUI-based. They contain graphical-user
interface (GUI) components that allow the user to interact with the software by
using both the keyboard and the mouse. They have graphical components such
as icons, menu bars, and windows that make the services easy to access.
Some examples of GUI-based user agents are Eudora, Microsoft's Outlook,
and Netscape.

 Message Transfer Agent (MTA):


 The actual mail transfer is done through message transfer agents.
 To send mail, a system must have the client MTA, and to receive mail, a system must
have a server MTA.
 The formal protocol that defines the MTA client and server in the Internet is called
the Simple Mail Transfer Protocol (SMTP).

Simple Mail Transfer Protocol:


 SMTP is used two times,
 Between the sender and the sender's mail server and
 between the two mail servers.
 SMTP simply defines how commands and responses must be sent back and forth.
 Each network is free to choose a software package for implementation.

Figure: SMTP Range


 SMTP simply defines how commands and responses must be sent back and forth.
Each network is free to choose a software package for implementation.
 Commands and Responses
SMTP uses commands and responses to transfer messages between an MTA client
and an MTA server.

B.Tech III Year II Semester ECE Page 16 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: SMTP commands and responses


 Each command or reply is terminated by a two-character (carriage return and line
feed) end-of-line token.
 Commands: Commands are sent from the client to the server.

Figure: Command Format

Figure: List of commands


 Responses: Responses are sent from the server to the client. A response is a three
digit code that may be followed by additional textual information.

B.Tech III Year II Semester ECE Page 17 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: List of responses

 Message Access Agent (MAA):


 The first and the second stages of mail delivery use SMTP. However, SMTP is not involved
in the third stage because SMTP is a push protocol; it pushes the message from the client to
the server.
 In other words, the direction of the bulk: data (messages) is from the client to the
server.
 The third stage needs a pull protocol; the client must pull messages from the server.

B.Tech III Year II Semester ECE Page 18 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

 The direction of the bulk data is from the server to the client. The third stage uses a
message access agent.
 Currently two message access protocols are available: Post Office Protocol, version 3
(POP3) and Internet Mail Access Protocol, version 4 (IMAP4).

Figure: POP3 and IMAP4 range

 POP3:
 Post Office Protocol, version 3 (POP3) is simple and limited in functionality.
 The client POP3 software is installed on the recipient computer; the server
POP3 software is installed on the mail server.
 Mail access starts with the client when the user needs to download e-mail from
the mailbox on the mail server.
 The client opens a connection to the server on TCP port 110.
 It then sends its user name and password to access the mailbox.
 The user can then list and retrieve the mail messages, one by one.

B.Tech III Year II Semester ECE Page 19 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: The exchange of commands and responses in POP3


 POP3 has two modes:
1. The delete mode: In the delete mode, the mail is deleted from the
mailbox after each retrieval.
2. The keep mode: In the keep mode, the mail remains in the mailbox
after retrieval.
ARCHITECTURE OF E-MAIL:

 The architecture of the e-Mail can be explained with four scenarios:


 First Scenario:
 In the first scenario, the sender and the receiver of the e-mail are users (or application
programs) on the same system; they are directly connected to a shared system.
 The administrator has created one mailbox for each user where the received messages are
stored.
 A mailbox is part of a local hard drive, a special file with permission restrictions. Only the
owner of the mailbox has access to it.
 When, A a user, needs to send a message to B another user, A runs a user agent (VA) program
to prepare the message and store it in B's mailbox.
 The message has the sender and recipient mailbox addresses (names of files).
 B can retrieve and read the contents of his mailbox at his convenience, using a user agent.
When the sender and the receiver of an e-mail are on the same system,
we need only two user agents.

Figure: The First Scenario of e-Mail


 Second Scenario:
 In the second scenario, the sender and the receiver of the e-mail are users (or application
programs) on two different systems.
 The message needs to be sent over the Internet. Here we need user agents (VAs) and message
transfer agents (MTAs).
 Sender (Alice) needs to use a user agent program to send her message to the system at its own
site.
 The system (sometimes called the mail server) at her site uses a queue to store messages
waiting to be sent.

B.Tech III Year II Semester ECE Page 20 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

 Receiver (Bob) also needs a user agent program to retrieve messages stored in the mailbox of
the system at its site.
 The message, needs to be sent through the Internet from sender's site to receiver's site.
 Two message transfer agents are needed: one 'client and one server.
 Like most client/server programs on the Internet, 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 alerted by the system when there is a message in the
queue to be sent.
When the sender and the receiver of an e-mail are on different systems,
we need two VAs and a pair of MTAs (client and server).

Figure: Second scenario of e-Mail architecture


 Third Scenario:
 In the third scenario, Receiver (Bob), as in the second scenario, is directly connected to its
system.
 Sender (Alice), however, is separated from her system. Either Alice is connected to the
system via a point-to-point WAN, such as a dial-up modem, a DSL, or a cable modem; or it
is connected to a LAN in an organization that uses one mail server for handling e-mails-all
users need to send their messages to this mail server.
 Sender (Alice) still needs a user agent to prepare her message.
 It then needs to send the message through the LAN or WAN. This can be done through a pair
of message transfer agents (client and server).
 Whenever Sender (Alice) has a message to send, it calls the user agent which, in turn, calls
the MTA client. The MTA client establishes a connection with the MTA server on the
system, which is running all the time.
 The system at Sender's site queues all messages received. It then uses an MTA client to send
the messages to the system at Receiver's site. The system receives the message and stores it in
Bob's mailbox.
 Receiver(Bob) uses its user agent to retrieve the message and reads it. Note that we need two
pairs of MTA client/server programs.
When the sender is connected to the mail server via a LAN or a WAN, we need two VAs and two
pairs of MTAs (client and server).

B.Tech III Year II Semester ECE Page 21 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: Third Scenario of e-Mail architecture


 Fourth Scenario:
 In the fourth and most common scenario, Bob is also connected to his mail server by a WAN
or a LAN.
 After the message has arrived at Bob's mail server, Bob needs to retrieve it. Here, we need
another set of client/server agents, which we call message access agents (MAAs).
 Bob uses an MAA client to retrieve his messages. The client sends a request to the MAA
server, which is running all the time, and requests the transfer of the messages.
 First, Bob cannot bypass the mail server and use the MTA server directly.
 To use MTA server directly, Bob would need to run the MTA server all the time because he
does not know when a message will arrive. This implies that
 Bob must keep his computer on all the time if he is connected to his system through a LAN.
 If he is connected through a-WAN, he must keep the connection up all the time. Neither of
these situations is feasible today.
 Bob needs another pair of client/server programs: message access programs. This is so
because an MTA client/server program is a push program: the client pushes the message to
the server. Bob needs a pull program. The client needs to pull the message from the server.

When both sender and receiver are connected to the mail server via a LAN or a WAN, we
need two VAs, two pairs of MTAs (client and server), and a pair of MAAs (client and
server). This is the most common situation today.

B.Tech III Year II Semester ECE Page 22 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: Fourth Scenario Of e-Mail Architecture


 Push Vs Pull:

5.3 WORLD WIDE WEB


 The World Wide Web (WWW) is a repository of information linked together from points all over
the world.
 The WWW has a unique combination of flexibility, portability, and user-friendly features that
distinguish it from other services provided by the Internet.
 The WWW project was initiated by CERN (European Laboratory for Particle Physics) to create a
system to handle distributed resources necessary for scientific research.
 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 documents, referred to as Web pages.
 Each Web page can contain a link to other pages in the same site or at other sites.
 The pages can be retrieved and viewed by using browsers.
 The client needs to see some information that it knows belongs to site A.
 It sends a request through its browser, a program that is designed to fetch Web documents.
 The request, among other information, includes the address of the site and the Web page,
called the URL.

B.Tech III Year II Semester ECE Page 23 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

 The server at site A finds the document and sends it to the client. When the user views the
document, she finds some references to other documents, including a Web page at site B.
 The reference has the URL for the new site. The user is also interested in seeing this
document.
 The client sends another request to the new site, and the new page is retrieved.

Figure: Architecture of WWW


 CLIENT (BROWSER):
o A variety of vendors offer commercial browsers that interpret and display a Web
document, and all use nearly the same architecture.
o Each browser usually consists of three parts:
 A controller: 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.
 Client protocol: The client protocol can be one of the protocols described
previously such as FTP or HTIP.
 Interpreters: The interpreter can be HTML, Java, or JavaScript, depending on
the type of document.

Figure: WWW Client ( Browser)


 SERVER
o The Web page is stored at the server.
o Each time a client request arrives, the corresponding document is sent to the client.
o A server can also become more efficient through multithreading or multiprocessing.
In this case, a server can answer more than one.

B.Tech III Year II Semester ECE Page 24 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

 URL ( Uniform Resource Locator):


o A client that wants to access a Web page needs the address.
o To facilitate the access of documents distributed throughout the world, HTTP uses
locators.
o The uniform resource locator (URL) is a standard for specifying any kind of
information on the Internet.
o The URL defines four things: protocol, host computer, port, and path.

o The protocol or method is the client/server program used to retrieve the document.
Ex: FTP or HTTP.
o The host is the computer on which the information is located, although the name of
the computer can be an alias. Web pages are usually stored in computers, and
computers are given alias names that usually begin with the characters "www". This
is not mandatory.
o The URL can optionally contain the port number of the server. If the port is included,
it is inserted between the host and the path, and it is separated from the host by a
colon.
o Path is the pathname of the file where the information is located.

 WEB DOCUMENTS
 The documents in the WWW can be grouped into three broad categories: Static, Dynamic,
and Active.
 The category is based on the time at which the contents of the document are determined.

 Static Documents:
o Static documents are fixed-content documents that are created and stored in a server.
o The client can get only a copy of the document. In other words, the contents of the
file are determined when the file is created, not when it is used.
o The contents in the server can be changed, but the user cannot change them. When a
client accesses the document, a copy of the document is sent.
o The user can then use a browsing program to display the document.

B.Tech III Year II Semester ECE Page 25 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: Static Documents


 Dynamic Documents
o A dynamic document is created by a Web server whenever a browser requests the
document. When a request arrives, the Web server runs an application program or a
script that creates the dynamic document.
o The server returns the output of the program or script as a response to the browser
that requested the document. Because a fresh document is created for each request,
the contents of a dynamic document can vary from one request to another.
o A very simple example of a dynamic document is the retrieval of the time and date
from a server.
o Time and date are kinds of information that are dynamic in that they change from
moment to moment. The client can ask the server to run a program such as the date
program in UNIX and send the result of the program to the client.

Figure: Dynamic Documents

B.Tech III Year II Semester ECE Page 26 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

 Active Documents
o For many applications, we need a program or a script to be run at the client site.
These are called active documents.
o For example, suppose we want to run a program that creates animated graphics on the
screen or a program that interacts with the user.
o The program definitely needs to be run at the client site where the animation or
interaction takes place.
o When a browser requests an active document, the server sends a copy of the
document or a script.
o The document is then run at the client (browser) site.

Figure: Active Documents

5.4 MULTIMEDIA
 Multimedia means that computer information can be represented through audio, video, and animation
in addition to traditional media (i.e., text, graphics drawings, images).
 The audio and video services into three broad categories: Streaming Stored Audio/Video, Streaming
Live Audio/Video, and Interactive Audio/Video.

 Streaming stored audio/video refers to on-demand requests for compressed audio/video files.
B.Tech III Year II Semester ECE Page 27 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

 Streaming live audio/video refers to the broadcasting of radio and TV programs through the
Internet.
 Interactive audio/video refers to the use of the Internet for interactive audio/video applications.
 DIGITIZING AUDIO AND VIDEO:
 Before audio or video signals can be sent on the Internet, they need to be digitized.
 Digitizing Audio:
o When sound is fed into a microphone, an electronic analog signal is generated which
represents the sound amplitude as a function of time. The signal is called an analog
audio signal.
o An analog signal, such as audio, can be digitized to produce a digital signal.
o According to the Nyquist theorem, if the highest frequency of the signal is f, we need
to sample the signal 21 times per second.
o Voice is sampled at 8000 samples per second with 8 bits per sample. This results in a
digital signal of 64 kbps.
o Music is sampled at 44,100 samples per second with 16 bits per sample. This results
in a digital signal of 705.6 kbps for monaural and 1.411 Mbps for stereo.
 Digitizing Video:
o A video consists of a sequence of frames. If the frames are displayed on the screen
fast enough, we get an impression of motion. There is no standard number of frames
per second
o To avoid a condition known as flickering, a frame needs to be refreshed.
o The TV industry repaints each frame twice. This means 50 frames need to be sent, or
if there is memory at the sender site, 25 frames with each frame repainted from the
memory.
o Each frame is divided into small grids, called picture elements or pixels. For
blackand- white TV, each 8-bit pixel represents one of 256 different gray levels.
o For a color TV, each pixel is 24 bits, with 8 bits for each primary color (red, green,
and blue).
o To send video using lower-rate technologies, we need to compress the video.
Compression is needed to send video over the Internet.

 AUDIO AND VIDEO COMPRESSION


 To send audio or video over the Internet requires compression.
 Audio Compression:
o Audio compression can be used for speech or music. For speech, we need to
compress a 64-kHz digitized signal; for music, we need to compress a 1.41 I-MHz
signal.
o Two categories of techniques are used for audio compression:
1. Predictive encoding and
2. Perceptual encoding.
o Predictive Encoding:
 In predictive encoding, the differences between the samples are encoded
instead of encoding all the sampled values. This type of compression is
normally used for speech.
B.Tech III Year II Semester ECE Page 28 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

 Several standards have been defined such as GSM (13 kbps), G.729 (8 kbps),
and G.723.3 (6.4 or 5.3 kbps).
o Perceptual Encoding: MP3
 The most common compression technique that is used to create CD-quality
audio is based on the perceptual encoding technique. This type of audio needs
at least 1.411 Mbps; this cannot be sent over the Internet without
compression.
 MP3 (MPEG audio layer 3), a part of the MPEG standard , uses this
technique.
 Perceptual encoding is based on the science of psychoacoustics, which is the
study of how people perceive sound. The idea is based on flaws in our
auditory system: Some sounds can mask other sounds. Masking can happen in
frequency and time.
 In frequency masking, a loud sound in a frequency range can partially or
totally mask a softer sound in another frequency range.
 In temporal masking, a loud sound can numb our ears for a short time even
after the sound has stopped.
 MP3 uses these two phenomena, frequency and temporal masking, to
compress audio signals.
 The technique analyzes and divides the spectrum into several groups. Zero
bits are allocated to the frequency ranges that are totally masked.
 A small number of bits are allocated to the frequency ranges that are partially
masked. A larger number of bits are allocated to the frequency ranges that are
not masked.
 MP3 produces three data rates: 96 kbps, 128 kbps, and 160 kbps. The rate is
based on the range of the frequencies in the original analog audio.
 Video Compression:
o video is composed of multiple frames. Each frame is one image.
o To do video compression, first image must be compressed.
o There are two standards for Video Compression:
1. Joint Photographic Experts Group (JPEG) is used to compress images.
2. Moving Picture Experts Group (MPEG) is used to compress video.
o Image Compression: JPEG
 If the picture is not in color (gray scale), each pixel can be represented by an
8-bit integer (256 levels).
 If the picture is in color, each pixel can be represented by 24 bits (3 x 8 bits),
with each 8 bits representing red, blue, or green (RBG).
 In JPEG, a gray scale picture is divided into blocks of 8 x 8 pixels.

B.Tech III Year II Semester ECE Page 29 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: JPEG gray scale


 The whole idea of JPEG is to change the picture into a linear (vector) set of
numbers that reveals the redundancies.
 The redundancies (lack of changes) can then be removed by using one of the
text compression methods.
 A simplified scheme of the process is

Figure: JPEG compression

 Discrete Cosine Transform (DCT): In this step, each block of 64 pixels goes
through a transformation called the discrete cosine transform (DCT). The
transformation changes the 64 values so that the relative relationships between
pixels are kept but the redundancies are revealed.
 Case 1: In this case, we have a block of uniform gray, and the value of each
pixel is 20. When we do the transformations, we get a nonzero value for the
first element (upper left corner); the rest of the pixels have a value of 0. The
value of T(0,0) is the average (multiplied by a constant) of the P(x,y) values
and is called the de value (direct current, borrowed from electrical
engineering). The rest of the values, called ae values, in T(m,n) represent
changes in the pixel values. But because there are no changes, the rest of the
values are 0s.

B.Tech III Year II Semester ECE Page 30 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: Uniform Gray Scale


 Case 2: In the second case, we have a block with two different uniform gray
scale sections. There is a sharp change in the values of the pixels (from 20 to
50). When we do the transformations, we get a dc value as well as nonzero ac
values. However, there are only a few nonzero values clustered around the dc
value. Most of the values are 0.

Figure: Two gray scale sections

 Case 3: In the third case, we have a block that changes gradually. That is,
there is no sharp change between the values of neighbouring pixels. When we
do the transformations, we get a de value, with many nonzero ac values also.

Figure: Gradient gray scale


 Quantization: Mter, the Ttable is created, the values are quantized to reduce
the number of bits needed for encoding. we divide the number by a constant
and then drop the fraction. This reduces the required number of bits even
more. In most implementations, a quantizing table (8 x 8) defines how to
quantize each value. The divisor depends on the position of the value in the T
table. This is done to optimize the number of bits and the number of 0s for
each particular application. Note that the only phase in the process that is not
reversible is the quantizing phase. We lose some information here that is not
recoverable. So, JPEG is called lossy compression is because of this
quantization phase.
 Compression: After quantization, the values are read from the table, and
redundant 0s are removed. However, to cluster the 0s together, the table is
read diagonally in a zigzag fashion rather than row by row or column by
column. The reason is that if the picture changes smoothly, the bottom right
corner of the T table is all 0s.

B.Tech III Year II Semester ECE Page 31 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: Reading Table

o Video Compression: MPEG


 The Moving Picture Experts Group method is used to compress video.
 In principle, a motion picture is a rapid flow of a set of frames, where each
frame is an image. In other words, a frame is a spatial combination of pixels,
and a video is a temporal combination of frames that are sent one after
another.
 Compressing video, then, means spatially compressing each frame and
temporally compressing a set of frames.
 Spatial Compression: The spatial compression of each frame is done with
JPEG (or a modification of it). Each frame is a picture that can be
independently compressed.
 Temporal Compression: In temporal compression, redundant frames are
removed. When we watch television, we receive 50 frames per second.
However, most of the consecutive frames are almost the same. For example,
when someone is talking, most of the frame is the same as the previous one
except for the segment of the frame around the lips, which changes from one
frame to another. To temporally compress data, the MPEG method first
divides frames into three categories: I-frames, P-frames, and B-frames.
 I-frames: An intra-coded frame (I-frame) is an independent frame that is not
related to any other frame. They are present at regular intervals. An I-frame
must appear periodically to handle some sudden change in the frame that the
previous and following frames cannot show.
 P-frames: A predicted frame (P-frame) is related to the preceding I-frame or
P-frame. In other words, each P-frame contains only the changes from the
preceding frame. The changes, however, cannot cover a big segment. P-frames
can be constructed only from previous I- or P-frames. P-frames carry much
less information than other frame types and carry even fewer bits after
compression.
 B-frames: A bidirectional frame (B.frame) is related to the preceding and
following I-frame or P-frame. In other words, each B-frame is relative to the
past and the future. Note that a B-frame is never related to another B-frame.

B.Tech III Year II Semester ECE Page 32 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)
Computer Networks Unit - V Application Layer

Figure: Sample sequence of Frames in MPEG

Figure: MPEG frame construction

B.Tech III Year II Semester ECE Page 33 Mr. M. Yadaiah, Asst.Professor,CSE (GNITC)

You might also like