DC UNIT-5 (1)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

DATA COMMUNICATION

UNIT-5
Application Layer: Principles of Networking Applications – Network Application
Architectures, Processes Communicating, Transport Services Available to Applications,
Transport Services Provided by the File Transfer: FTP,- FTP Commands and Replies,
Electronic Mail in the Internet- STMP, Comparison with HTTP, DNS-The Internet’s
Directory Service – Service Provided by DNS, Overview of How DNS Works, DNS
Records and messages.

Principles of Networking Applications: Network Application Architectures,


Processes Communicating, Transport Services Available to Applications:

The Principles of Network Applications are fundamental concepts that govern the design
and development of applications that run on a computer network. These principles
encompass several key aspects of network applications, including:
 Network Application Architectures
 Processes Communicating
 The Interface Between the Process and the Computer Network
 Transport Services Available to Applications
 Transport Services Provided by the Internet
 Application-Layer Protocols
1. Network Application Architectures refer to the overall design and structure of a
network application. It encompasses how the application is divided into different
components, and how these components interact with each other. There are several
commonly used network application architectures, including:
 Client-Server Architecture: In this architecture, one component acts as a client and
makes requests to a server component, which provides the requested services. This
architecture is commonly used in web applications, where the client is a web browser
and the server is a web server.
 Peer-to-Peer Architecture: In this architecture, every component is both a client and a
server, and each component can communicate directly with any other component. This
architecture is commonly used in file-sharing applications, where each user’s device
acts as both a client and a server.
 Three-Tier Architecture: In this architecture, the application is divided into three
components: a client component, a middleware component, and a database component.
The client component makes requests to the middleware component, which
communicates with the database component to retrieve or update data. This architecture
provides a layer of abstraction between the client and the database, which can improve
performance and scalability.
 Microservices Architecture: In this architecture, the application is divided into a
collection of small, independently deployable components, known as microservices.
Each microservice is responsible for a specific aspect of the application’s functionality,
and they communicate with one another through APIs. This architecture allows for
greater flexibility and scalability compared to other architectures.
The choice of network application architecture depends on several factors, including the
requirements of the application, the scale of the application, and the available resources.
Regardless of the architecture chosen, the design should consider factors such as scalability,
performance, security, and maintainability.
2. Processes Communicating refers to the communication between multiple processes in a
computer network. Processes can be thought of as individual programs or tasks running on
a device, and they may be located on the same device or on different devices connected to
the network.
 Communication between processes is facilitated by the use of protocols, which define
the rules and formats for exchanging data. The communication between processes can
be either synchronous or asynchronous, meaning that either both processes must be
available to communicate at the same time or the communication can occur at different
times.
 In a network application, communication between processes is essential for the
application to function correctly. For example, in a client-server architecture, the client
process makes requests to the server process, and the server process returns the
requested information. In a peer-to-peer architecture, each process can communicate
directly with any other process.
 It’s important to consider the communication between processes when designing a
network application. Factors such as the reliability of communication, the security of
communication, and the performance of the communication must be taken into account.
The choice of protocols used for communication will depend on the requirements of the
application and the network infrastructure.
3. The Interface between the Process and the Computer Network refers to the
connection between a process running on a device and the underlying computer network.
This interface determines how the process communicates with other processes and with the
network itself.
The interface between a process and the computer network is usually provided by a
network stack, which is a collection of protocols and services that handle the
communication between the process and the network. The network stack translates the
process’s requests and data into the appropriate network protocols, and vice versa, allowing
the process to communicate over the network.
The network stack typically includes several layers, each with its own specific
responsibilities. The layers may include:
1. Application Layer: This layer provides the interface between the process and the
network stack. It defines the protocols and services used by the process to communicate
with the network.
2. Transport Layer: This layer provides the underlying transport services that enable the
process to communicate with other processes over the network. These services include
protocols such as TCP (Transmission Control Protocol) and UDP (User Datagram
Protocol).
3. Network Layer: This layer provides the basic mechanisms for routing data between
devices on the network. The Internet Protocol (IP) is the most commonly used network
layer protocol.
4. Link Layer: This layer provides low-level communication services between devices on
the same physical network. The link layer is responsible for error detection and
correction, and for determining the best path for data to travel over the network.
The interface between the process and the computer network is a critical component of a
network application, and its design must take into account factors such as performance,
reliability, security, and compatibility with the network infrastructure. The choice of
network stack and protocols used will depend on the requirements of the application and
the underlying network.
4. Transport Services Available to Applications are the services provided by the network
stack that enable applications to communicate with each other over a computer network.
These services are responsible for ensuring that data is reliably delivered between
applications, and they provide the underlying communication infrastructure for the
application.
There are several transport services available to applications, including:
1. TCP (Transmission Control Protocol): TCP is a reliable, connection-oriented transport
service that provides error-checking and flows control to ensure that data is delivered
accurately. Applications that require reliable data delivery, such as email or file transfer,
typically use TCP.
2. UDP (User Datagram Protocol): UDP is an unreliable, connectionless transport service
that does not provide error checking or flow control. Applications that require low
latency or high speed, such as video streaming or online gaming, typically use UDP.
3. SCTP (Stream Control Transmission Protocol): SCTP is a reliable, multi-homed
transport service that provides error checking and flow control. SCTP can handle
multiple streams of data between applications, allowing for efficient communication
between applications.
4. DCCP (Datagram Congestion Control Protocol): DCCP is a transport service that
provides congestion control for applications that do not require reliable data delivery.
Transport Services Provided by the InternetThe choice of transport service will depend on
the requirements of the application, including reliability, performance, and security
requirements. For example, an application that requires reliable data delivery, such as
email, would use TCP, while an application that requires low latency and high speed, such
as online gaming, would use UDP.
5. Transport Services Provided by the Internet: The Internet provides two primary transport
services for applications: TCP (Transmission Control Protocol) and UDP (User Datagram
Protocol).
1. TCP: TCP is a reliable, connection-oriented transport service that provides error-
checking and flows control to ensure that data is delivered accurately. Applications that
require reliable data delivery, such as email or file transfer, typically use TCP. TCP
establishes a reliable connection between two devices and ensures that data is
transmitted in the correct order and without errors.
2. UDP: UDP is an unreliable, connectionless transport service that does not provide error
checking or flow control. Applications that require low latency or high speed, such as
video streaming or online gaming, typically use UDP. Because UDP does not provide
error checking or flow control, it is faster and more efficient than TCP, but it may not be
suitable for applications that require reliable data delivery.
In addition to these two primary transport services, the Internet may also provide other
transport services, such as SCTP (Stream Control Transmission Protocol) or DCCP
(Datagram Congestion Control Protocol), depending on the specific implementation. The
choice of transport service will depend on the requirements of the application and the
underlying network infrastructure.
6. Application-layer protocols are data exchange protocols used to allow communication
between applications on different devices. They operate at the highest layer of the OSI
(Open Systems Interconnection) model, which is the application layer. Application-layer
protocols define the rules for exchanging data between applications, such as formatting,
error detection and correction, and security. Examples of application-layer protocols
include HTTP, HTTPS, FTP, SMTP, POP3, IMAP, and many others. They are used in
various applications such as web browsing, email, file transfer, and more.

Transport Services Provided by the File Transfer: FTP,- FTP Commands


and Replies:

FTP (File Transfer Protocol) is a standard network protocol used for the transfer of files from
one host to another over a TCP-based network, such as the Internet. During an FTP
transmission, there are four commands used by the computers, servers, or proxy servers that
are communicating. These are “send,” “get,” “change directory,” and “transfer.”

While transferring files, FTP uses three different modes: block, stream, and compressed.
One of the main reasons why modern businesses and individuals need FTP is its ability to
perform large file size transfers. When sending a relatively small file, like a Word document,
most methods will do, but with FTP, you can send hundreds of gigabytes at once and still get
a smooth transmission.

The three most common ways of using FTP include:

1. Via a web browser: With a web browser, you do not need any special software or a client to
download files from servers that provide for FTP sites.
2. A general user interface (GUI) FTP client: These third-party applications enable users to
connect and then send files over FTP.
3. Command-line FTP: Major operating systems come equipped with FTP client capabilities as
a command line.

FTP Commands and Replies:

The commands, from each client to server, and replies, from server to client, are sent
across the control connection in 7-bit ASCII format. Thus, like HTTP commands,
FTP commands are readable by people. In order to delineate successive commands, a
carriage return and line feed end each command. Each command consists of four
uppercase ASCII characters, some with optional arguments.

 USER username: Used to send the user identification to the server.


 PASS password: Used to send the user password to the server.
 LIST: Used to ask the server to send back a list of all the files in the current remote
directory. The list of files is sent over a (new and non-persistent ) data connection rather
than the control TCP connection.
 RETR filename: Used to retrieve (that is, get) a file from the current directory of the
remote host. This command causes the remote host to initiate a data connection and to
send the requested file over the data connection.
 STOR filename: Used to store (that is, put) a file into the current directory of the remote
host.
Electronic Mail in the Internet- STMP:
ELECTRONIC 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.

Architecture

1. 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 Alice, a user, needs to send a message
to Bob, another user, Alice runs a user agent (UA) program to prepare the message and store
it in Bob's mailbox. The message has the sender and recipient mailbox addresses (names of
files). Bob can retrieve and read the contents of his mailbox at his convenience, using a user
agent.

2. 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 (UAs) and message transfer agents (MTAs).

3.Third Scenario In the third scenario, Bob, as in the second scenario, is directly connected to
his system. 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 she
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.
4.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.

There are two important points here. 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. Second, note that 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.

Message Transfer Agent: SMTP 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). As we said before, two pairs of
MTA client/server programs are used in the most common situation (fourth scenario).

SMTP is used two times, between the sender and the sender's mail server and between the
two mail servers. As we will see shortly, another protocol is needed between the mail server
and the receiver.

SMTP simply defines how commands and responses must be sent back and forth. Each
network is free to choose a software package for implementation. We discuss the mechanism
of mail transfer by SMTP in the remainder of the section.

Commands and Responses SMTP uses commands and responses to transfer messages
between an MTA client and an MTA server.
Comparison with HTTP:

SMTP and HTTP are both network layer protocols that are used to
transfer information between hosts. SMTP is used to transfer emails
between mail servers, while HTTP is used to transfer data from a web
server to a web client.

SMTP
SMTP (Simple Mail Transfer Protocol) is a protocol for managing Internet’s
electronic mail. It is an application layer protocol. It uses TCP due to its reliable
data transfer service. TCP establishes SMTP connections at port 25. SMTP uses
persistent connections. The same TCP connection can be used to send multiple
emails, once the connection has been established. Only 7-bit ASCII content is to be
directly sent. Other content needs to be encoded to 7-bit ASCII and then decoded
at the receiving end.

DNS uses distributed servers so that data remains distributed in places and per
server load decreases. But SMTP never uses intermediate mail servers. Mail sent
by user A to B will go directly from A’s server to B’s server, and nowhere in
between.

HTTP
HTTP is a client-server protocol. It is IP based communication protocol that is used
to deliver data from server to client or vice-versa. Any type of content can be
exchanged as long as the server and client are compatible with it.
Difference between SMTP and HTTP
SMTP HTTP

HTTP is mainly used for data and file


SMTP is used for mail services.
transfer.

It uses port 25. It uses port 80.

It is primarily a push protocol. It is primarily a pull protocol.

It imposes a 7-bit ASCII restriction on the It does not impose a 7-bit ASCII restriction.
content to be transferred. Can transfer multimedia, hyperlinks, etc.

HTTP transfers files between the Web


SMTP transfers emails via Mail Servers.
server and the Web client.

SMTP is a persistent type of TCP It can use both Persistent and Non-
connection. persistent.

Uses different methods of authentication


Uses base64 encoding for authentication.
such as basic, digest, and OAuth.

Does not support session management or Supports session management and cookies
cookies. to maintain state.

Has a smaller message size limit Has a larger message size limit compared to
compared to HTTP. SMTP.

Requires authentication for sending Does not require authentication for


SMTP HTTP

emails. browsing web pages.

Supports both plain text and encrypted Supports both plain text and encrypted
communication (SMTPS or STARTTLS). communication (HTTPS).

DNS-The Internet’s Directory Service – Service Provided by DNS,


Overview of How DNS Works, DNS Records and messages.
DNS stands for Domain Name System. DNS is a directory service that provides a mapping
between the name of a host on the network and its numerical address. Below figure shows an
example of how a DNS client/server program can support an e-mail program to find the IP
address of an e-mail recipient. A user of an e-mail program may know the email address of
the recipient; however, the IP protocol needs the IP address. The DNS client program sends a
request to a DNS server to map the e-mail address to the corresponding IP address.

DNS IN THE 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.
Generic Domains The generic domains define registered hosts according to their generic
behavior. Each node in the tree defines a domain, which is an index to the domain name
space database.
Country Domains The country domains section uses two-character country abbreviations
(e.g., us for United States). Second labels can be organizational, or they can be more specific,
national designations. The United States, for example, uses state abbreviations as a
subdivision of us (e.g., ca.us.). Below Figure shows the country domains section. The address
anza.cup.ca.us can be translated to De Anza College in Cupertino, California, in the United
States.

Inverse Domain The inverse domain is used to map an address to a name. 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.
To handle a pointer query, the inverse domain is added to the domain name space with the
first-level node called arpa (for historical reasons). The second level is also one single node
named in-addr (for inverse address). The rest of the domain defines IP addresses.
Overview of How DNS Works:

The process of DNS resolution involves converting a hostname (such as www.example.com)


into a computer-friendly IP address (such as 192.168.1.1). An IP address is given to each
device on the Internet, and that address is necessary to find the appropriate Internet device -
like a street address is used to find a particular home. When a user wants to load a webpage,
a translation must occur between what a user types into their web browser (example.com)
and the machine-friendly address necessary to locate the example.com webpage.

In order to understand the process behind the DNS resolution, it’s important to learn about
the different hardware components a DNS query must pass between. For the web browser,
the DNS lookup occurs "behind the scenes" and requires no interaction from the user’s
computer apart from the initial request.

There are 4 DNS servers involved in


loading a webpage:
 DNS recursor - The recursor can be thought of as a librarian who is asked to go
find a particular book somewhere in a library. The DNS recursor is a server
designed to receive queries from client machines through applications such as
web browsers. Typically the recursor is then responsible for making additional
requests in order to satisfy the client’s DNS query.

 Root nameserver - The root server is the first step in translating (resolving)
human readable host names into IP addresses. It can be thought of like an index
in a library that points to different racks of books - typically it serves as a
reference to other more specific locations.

 TLD nameserver - The top level domain server (TLD) can be thought of as a
specific rack of books in a library. This nameserver is the next step in the search
for a specific IP address, and it hosts the last portion of a hostname (In
example.com, the TLD server is “com”).

 Authoritative nameserver - This final nameserver can be thought of as a dictionary


on a rack of books, in which a specific name can be translated into its definition.
The authoritative nameserver is the last stop in the nameserver query. If the
authoritative name server has access to the requested record, it will return the IP
address for the requested hostname back to the DNS Recursor (the librarian) that
made the initial request.

DNS Records and messages:


TYPES OF RECORDS Two types of records are used in DNS. The question records are used
in the question section of the query and response messages. The resourcerecords are used in
the answer, authoritative, and additional information sections of the response message.

Question Record A question record is used by the client to get information from a server.
This contains the domain name.

Resource Record 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.
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; the response message consists of a
header, question records, answer records, authoritative records, and additional records.

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 shown in below
Figure.

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. Finally, 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.

Question Section This is a section consisting of one or more question records. It is present
on both query and response messages. We will discuss the question records in a following
section.
Answer Section This is a section consisting 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).

Authoritative Section This is a section consisting 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.

Additional Information Section This is a section consisting of one or more resource


records. It is present only on response messages. This section provides additional information
that may help the resolver.

You might also like