0% found this document useful (0 votes)
9 views

Application Layer

Uploaded by

chviswa31
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Application Layer

Uploaded by

chviswa31
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

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.

File Transfer Protocol(FTP) is an application layer protocol that moves files between
local and remote file systems. It runs on top of TCP, like HTTP. To transfer a file, 2
TCP connections are used by FTP in parallel: control connection and data connection.
What is File Transfer Protocol?
FTP is a standard communication protocol. There are various other protocols like
HTTP which are used to transfer files between computers, but they lack clarity and
focus as compared to FTP. Moreover, the systems involved in connection are
heterogeneous, i.e. they differ in operating systems, directories, structures, character
sets, etc the FTP shields the user from these differences and transfers data efficiently
and reliably. FTP can transfer ASCII, EBCDIC, or image files. The ASCII is the
default file share format, in this, each character is encoded by NVT ASCII. In ASCII
or EBCDIC the destination must be ready to accept files in this mode. The image file
format is the default format for transforming binary files.
File Transfer Protocol

Types of FTP
There are different ways through which a server and a client do a file transfer using
FTP. Some of them are mentioned below:
 Anonymous FTP: Anonymous FTP is enabled on some sites whose files
are available for public access. A user can access these files without
having any username or password. Instead, the username is set to
anonymous, and the password is to the guest by default. Here, user access
is very limited. For example, the user can be allowed to copy the files but
not to navigate through directories.
 Password Protected FTP: This type of FTP is similar to the previous
one, but the change in it is the use of username and password.
 FTP Secure (FTPS): It is also called as FTP Secure Sockets Layer (FTP
SSL). It is a more secure version of FTP data transfer. Whenever FTP
connection is established, Transport Layer Security (TLS) is enabled.
 FTP over Explicit SSL/TLS (FTPES): FTPES helps by upgrading FTP
Connection from port 21 to an encrypted connection.
 Secure FTP (SFTP): SFTP is not a FTP Protocol, but it is a subset of
Secure Shell Protocol, as it works on port 22.
How Does FTP Work?
FTP is a client server protocol that has two communication channel, command channel
for conversation control and data channel for file content.
Here are steps mentioned in which FTP works:
 A user has to log in to FTP Server first, there may be some servers where
you can access to content without login, known as anonymous FTP.
 Client can start a conversation with server, upon requesting to download a
file.
 The user can start different functions like upload, delete, rename, copy
files, etc. on server.
FTP can work on different modes like Active and Passive modes. For more, you can
refer to Difference between Active and Passive FTP.

Types of Connection in FTP


 Control Connection
 Data Connection
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. The control connection is initiated on port number 21.
Data connection
For sending the actual file, FTP makes use of a data connection. A data connection is
initiated on port number 20.
FTP sends the control information out-of-band as it uses a separate control connection.
Some protocols send their request and response header lines and the data in the same
TCP connection. For this reason, they are said to send their control information in-
band. HTTP and SMTP are such examples.
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. But
the control connection remains active throughout the user session. As we know HTTP
is stateless . But FTP needs to maintain a state about its user throughout the session.
FTP Clients
FTP works on a client-server model. The FTP client is a program that runs on the
user’s computer to enable the user to talk to and get files from remote computers. It is
a set of commands that establishes the connection between two hosts, helps to transfer
the files, and then closes the connection.
Some of the commands are:
get the filename(retrieve the file from the server)
get the filename(retrieve multiple files from the server )
ls(list files available in the current directory of the server)
There are also built-in FTP programs, which makes it easier to transfer files and it
does not require remembering the commands.

FTP Data Types


The data type of a file, which determines how the file is represented overall, is the
first piece of information that can be provided about it. The FTP standard specifies
the following four categories of data:
 ASCII: Describes an ASCII text file in which each line is indicated by the
previously mentioned type of end-of-line marker.
 EBCDIC: For files that use IBM’s EBCDIC character set, this type is
conceptually identical to ASCII.
 Image: This is the “black box” mode I described earlier; the file has no
formal internal structure and is transferred one byte at a time without any
processing.
 Local: Files containing data in logical bytes with a bit count other than
eight can be handled by this data type.
FTP Replies
Some of the FTP replies are:
 200 – Command okay.
 530 – Not logged in.
 331 – User name okay, need a password.
 221 – Service closing control connection.
 551 – Requested action aborted: page type unknown.
 502 – Command not implemented.
 503 – Bad sequence of commands.
 504 – Command not implemented for that parameter.
Characteristics of FTP
 FTP uses TCP as a transport layer protocol.
 It is good for simple file transfers, such as during boot time.
 Errors in the transmission (lost packets, checksum errors) must be handled
by the TFTP server.
 It uses only one connection through well-known port 69.
 TFTP uses a simple lock-step protocol (each data packet needs to be
acknowledged). Thus the throughput is limited.
FTP’s Security Issues
 Information could not go across a secure tunnel since FTP was not
intended to do so. Thus, encryption is not present. A hacker would not
need to struggle with encryption to access or alter data that is usable if
they could intercept an FTP transaction.
 Even with FTP cloud storage, data can still be intercepted and misused if
the service provider’s system is attacked.
 As a result, data sent via FTP is a target for spoofing, sniffing, brute force,
and other types of attacks that move somewhat slowly. A hacker might
examine an FTP transmission and try to take advantage of any flaws by
simply port scanning.
 The fact that FTP uses clear-text passwords—passwords that haven’t been
encrypted—is one of its main security flaws. Put differently, “Jerry1992”
appears exactly like “Jerry1992.” The real password is hidden via an
algorithm in more secure protocols. As a result, “Jerry1992” might appear
as “dj18387saksng8937d9d8d7s6a8d89.” Passwords like this are not
secured by FTP, which makes them more easily cracked by malicious
actors.
Advantages of FTP
 File sharing also comes in the category of advantages of FTP in this
between two machines files can be shared on the network.
 Speed is one of the main benefits of FTP.
 Since we don’t have to finish every operation to obtain the entire file, it is
more efficient.
 Using the username and password, we must log in to the FTP server. As a
result, FTP might be considered more secure.
 We can move the files back and forth via FTP. Let’s say you are the firm
manager and you provide information to every employee, and they all
reply on the same server.
Disadvantages of FTP
 File size limit is the drawback of FTP only 2 GB size files can be
transferred.
 More then one receivers are not supported by FTP.
 FTP does not encrypt the data this is one of the biggest drawbacks of FTP.
 FTP is unsecured we use login IDs and passwords making it secure but
they can be attacked by hackers.

A network protocol is an accepted set of rules that govern data communication


between different devices in the network. In this article, we will see the difference
between SMTP and HTTP protocols.

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.
SMTP HTTP

It uses port 25. It uses port 80.

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

It does not impose a 7-bit ASCII


It imposes a 7-bit ASCII restriction on
restriction. Can transfer multimedia,
the content to be transferred.
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
compared to HTTP. to SMTP.

Requires authentication for sending Does not require authentication for


emails. browsing web pages.

Supports both plain text and encrypted


Supports both plain text and encrypted
communication (SMTPS or
communication (HTTPS).
STARTTLS).
Electronic mail, commonly known as email, is a method of exchanging
messages over the internet. Here are the basics of email:

1. An email address: This is a unique identifier for each user, typically in the
format of [email protected].
2. An email client: This is a software program used to send, receive and
manage emails, such as Gmail, Outlook, or Apple Mail.
3. An email server: This is a computer system responsible for storing and
forwarding emails to their intended recipients.

To send an email:

1. Compose a new message in your email client.


2. Enter the recipient’s email address in the “To” field.
3. Add a subject line to summarize the content of the message.
4. Write the body of the message.
5. Attach any relevant files if needed.
6. Click “Send” to deliver the message to the recipient’s email server.
7. Emails can also include features such as cc (carbon copy) and bcc (blind
carbon copy) to send copies of the message to multiple recipients, and
reply, reply all, and forward options to manage the conversation.
Electronic Mail (e-mail) is one of most widely used services of Internet. This
service allows an Internet user to send a message in formatted manner (mail) to
the other Internet user in any part of world. Message in mail not only contain text,
but it also contains images, audio and videos data. The person who is sending mail is
called sender and person who receives mail is called recipient. It is just like postal
mail service. Components of E-Mail System : The basic components of an email
system are : User Agent (UA), Message Transfer Agent (MTA), Mail Box, and
Spool file. These are explained as following below.
1. User Agent (UA) : The UA is normally a program which is used to send
and receive mail. Sometimes, it is called as mail reader. It accepts variety
of commands for composing, receiving and replying to messages as well
as for manipulation of the mailboxes.
2. Message Transfer Agent (MTA) : MTA is actually responsible for
transfer of mail from one system to another. To send a mail, a system must
have client MTA and system MTA. It transfer mail to mailboxes of
recipients if they are connected in the same machine. It delivers mail to
peer MTA if destination mailbox is in another machine. The delivery from
one MTA to another MTA is done by Simple Mail Transfer Protocol.

3. Mailbox : It is a file on local hard drive to collect mails. Delivered mails


are present in this file. The user can read it delete it according to his/her
requirement. To use e-mail system each user must have a mailbox . Access
to mailbox is only to owner of mailbox.
4. Spool file : This file contains mails that are to be sent. User agent appends
outgoing mails in this file using SMTP. MTA extracts pending mail from
spool file for their delivery. E-mail allows one name, an alias, to represent
several different e-mail addresses. It is known as mailing list, Whenever
user have to sent a message, system checks recipient’s name against alias
database. If mailing list is present for defined alias, separate messages, one
for each entry in the list, must be prepared and handed to MTA. If for
defined alias, there is no such mailing list is present, name itself becomes
naming address and a single message is delivered to mail transfer entity.
Services provided by E-mail system :
 Composition – The composition refer to process that creates messages
and answers. For composition any kind of text editor can be used.
 Transfer – Transfer means sending procedure of mail i.e. from the sender
to recipient.
 Reporting – Reporting refers to confirmation for delivery of mail. It help
user to check whether their mail is delivered, lost or rejected.
 Displaying – It refers to present mail in form that is understand by the
user.
 Disposition – This step concern with recipient that what will recipient do
after receiving mail i.e save mail, delete before reading or delete after
reading.

Advantages Or Disadvantages:
Advantages of email:

1. Convenient and fast communication with individuals or groups globally.


2. Easy to store and search for past messages.
3. Ability to send and receive attachments such as documents, images, and
videos.
4. Cost-effective compared to traditional mail and fax.
5. Available 24/7.

Disadvantages of email:

1. Risk of spam and phishing attacks.


2. Overwhelming amount of emails can lead to information overload.
3. Can lead to decreased face-to-face communication and loss of personal
touch.

Domain Name System (DNS) is a hostname for IP address translation service. DNS
is a distributed database implemented in a hierarchy of name servers. It is an
application layer protocol for message exchange between clients and servers. It is
required for the functioning of the Internet.
What is the Need of DNS?
Every host is identified by the IP address but remembering numbers is very difficult
for people also the IP addresses are not static therefore a mapping is required to change
the domain name to the IP address. So DNS is used to convert the domain name of the
websites to their numerical IP address.
Types of Domain
There are various kinds of domain:
1. Generic domains: .com(commercial), .edu(educational), .mil(military),
.org(nonprofit organization), .net(similar to commercial) all these are
generic domains.
2. Country domain: .in (India) .us .uk
3. Inverse domain: if we want to know what is the domain name of the
website. Ip to domain name mapping. So DNS can provide both the
mapping for example to find the IP addresses of geeksforgeeks.org then
we have to type
nslookup www.geeksforgeeks.org

Types of DNS

Organization of Domain
It is very difficult to find out the IP address associated with a website because there
are millions of websites and with all those websites we should be able to generate the
IP address immediately, there should not be a lot of delays for that to happen
organization of the database is very important.

Root DNS Server


 DNS record: Domain name, IP address what is the validity? what is the
time to live? and all the information related to that domain name. These
records are stored in a tree-like structure.
 Namespace: Set of possible names, flat or hierarchical. The naming
system maintains a collection of bindings of names to values – given a
name, a resolution mechanism returns the corresponding value.
 Name server: It is an implementation of the resolution mechanism.
DNS = Name service in Internet – A zone is an administrative unit,
and a domain is a subtree.
Name-to-Address Resolution
The host requests the DNS name server to resolve the domain name. And the name
server returns the IP address corresponding to that domain name to the host so that the
host can future connect to that IP address.

Name-to-Address Resolution

 Hierarchy of Name Servers Root name servers: It is contacted by name


servers that can not resolve the name. It contacts the authoritative name
server if name mapping is not known. It then gets the mapping and returns
the IP address to the host.
 Top-level domain (TLD) server: It is responsible for com, org, edu, etc,
and all top-level country domains like uk, fr, ca, in, etc. They have info
about authoritative domain servers and know the names and IP addresses
of each authoritative name server for the second-level domains.
 Authoritative name servers are the organization’s DNS servers,
providing authoritative hostnames to IP mapping for organization servers.
It can be maintained by an organization or service provider. In order to
reach cse.dtu.in we have to ask the root DNS server, then it will point out
to the top-level domain server and then to the authoritative domain name
server which actually contains the IP address. So the authoritative domain
server will return the associative IP address.
Domain Name Server
The client machine sends a request to the local name server, which, if the root does
not find the address in its database, sends a request to the root name server, which in
turn, will route the query to a top-level domain (TLD) or authoritative name server.
The root name server can also contain some hostName to IP address mappings. The
Top-level domain (TLD) server always knows who the authoritative name server is.
So finally the IP address is returned to the local name server which in turn returns the
IP address to the host.

Domain Name Server

How Does DNS Work?


The working of DNS starts with converting a hostname into an IP Address. A domain
name serves as a distinctive identification for a website. It is used in place of an IP
address to make it simpler for consumers to visit websites. Domain Name System
works by executing the database whose work is to store the name of hosts which are
available on the Internet. The top-level domain server stores address information for
top-level domains such as .com and .net, .org, and so on. If the Client sends the
request, then the DNS resolver sends a request to DNS Server to fetch the IP Address.
In case, when it does not contain that particular IP Address with a hostname, it
forwards the request to another DNS Server. When IP Address has arrived at the
resolver, it completes the request over Internet Protocol.
For more, you can refer to Working of DNS Server.
DNS MESSAGES:
DNS allows you to interact with devices on the Internet without having to remember
long strings of numbers. Changing of information between client and server is carried
out by two types of DNS messages:
 Query message
 Response message.
The format is similar for both types of messages. The information is held up in up to
five different sections of DNS message format. The query message is having two
sections- header and question records.
The response message consists of five sections:
 Header
 Question
 Records
 Answer records
 Authoritative records
 Additional records

The above representation is showing the DNS Message format in which some fields
are set to 0s for query messages.
 Identification: The identification field is made up of 16 bits which are used
to match the response with the request sent from the client-side. The
matching is carried out by this field as the server copies the 16-bit value of
identification in the response message so the client device can match the
queries with the corresponding response received from the server-side.
 Flags: It is 16 bits and is divided into the following Fields :

Here is the description of each subfield of the Flags field:


 QR (query/response): It is a 1-bit subfield. If its value is 0, the message is
of request type and if its value is 1, the message is of response type.
 opcode: It is a 4-bit subfield that defines the type of query carried by a
message. This field value is repeated in the response. Following is the list
of opcode values with a brief description:
 If the value of the opcode subfield is 0 then it is a standard query.
 The value 1 corresponds to an inverse of query that implies
finding the domain name from the IP Address.
 The value 2 refers to the server status request. The value 3
specifies the status reserved and therefore not used.
 AA: It is an Authoritative Answer. It is a 1-bit subfield that specifies the
server is authoritative if the value is 1 otherwise it is non-authoritative for a
0 value.
 TC: It is Truncation. This is a 1-bit subfield that specifies if the length of
the message exceeds the allowed length of 512 bytes, the message is
truncated when using UDP services.
 RD: It is Recursion Desired. It is a 1-bit subfield that specifies if the value
is set to 1 in the query message then the server needs to answer the query
recursively. Its value is copied to the response message.
 RA: It is Recursion Available. It is a 1-bit subfield that specifies the
availability of recursive response if the value is set to 1 in the response
message.
 Zero: It is a 3-bit reserved subfield set to 0.
 rCode: It stands for Response Code. It is a 4-bit subfield used to denote
whether the query was answered successfully or not. If not answered
successfully then the status of error is provided in the response. Following
is the list of values with their error status –
 The value 0 of rcode indicates no error.
 A value of 1 indicates that there is a problem with the format
specification.
 Value 2 indicates server failure.
 Value 3 refers to the Name Error that implies the name given by
the query does not exist in the domain.
 Value of 4 indicates that the request type is not supported by the
server.
 The value 5 refers to the nonexecution of queries by the server
due to policy reasons.

You might also like