Computer Networks Application Layer Notes
Computer Networks Application Layer Notes
The application layer in the OSI model is the closest layer to the end user which
means that the application layer and end user can interact directly with the software
application. The application layer programs are based on client and servers.
FTAM is an OSI standard that provides file transfer services between client
(initiator) and server (responder) systems in an open environment. It also provides
access to files and management of files on diverse systems. In these respects, it
strives to be a universal file system. FTAM has worked well as a way to bring
mainframe information systems into distributed environments, but FTAM has not
caught on otherwise.
FTAM is designed to help users access files on diverse systems that use compatible
FTAM implementations. It is similar to FTP (File Transfer Protocol) and NFS
(Network File System), both of which operate in the TCP/IP environment. Users
can manipulate files down to the record level, which is how FTAM stores files. In
this respect, FTAM has some relational database features. For example, users can
lock files or lock individual records.
FTAM is a system in which connection-oriented information about the user and the
session is maintained by a server until the session is taken down. In a stateless
system, such as NFS, requests are made independently of one another in a
connectionless manner. There are advantages to stateless operation. If the server
crashes, the request simply goes away and the client makes another request. This
simplifies recovery after the crash. In a stateful system, both systems must be aware
that one or the other has crashed so they can restore the states and prevent data
corruption.
So far, FTAM, like other OSI protocols, has not caught on as a useful system for
transferring files between different vendor systems in the LAN environment. Many
of the implementations so far have failed to interoperate with one another. FTAM
has worked well as a way to bring mainframe information systems into distributed
environments.
FTP
Objectives of FTP
Why FTP?
Although transferring files from one system to another is very simple and
straightforward, but sometimes it can cause problems. For example, two systems
may have different file conventions. Two systems may have different ways to
represent text and data. Two systems may have different directory structures. FTP
protocol overcomes these problems by establishing two connections between hosts.
One connection is used for data transfer, and another connection is used for the
control connection.
Mechanism of FTP
The above figure shows the basic model of the FTP. The FTP client has three
components: the user interface, control process, and data transfer process. The
server has two components: the server control process and the server data transfer
process.
o Control Connection: The control connection uses very simple rules for
communication. Through control connection, we can transfer a line of
command or line of response at a time. The control connection is made
between the control processes. The control connection remains connected
during the entire interactive FTP session.
o Data Connection: The Data Connection uses very complex rules as data
types may vary. The data connection is made between data transfer processes.
The data connection opens when a command comes for transferring the files
and closes when the file is transferred.
FTP Clients
o FTP client is a program that implements a file transfer protocol which allows
you to transfer files between two hosts on the internet.
o It allows a user to connect to a remote host and upload or download the files.
o It has a set of commands that we can use to connect to a host, transfer the
files between you and your host and close the connection.
o The FTP program is also available as a built-in component in a Web browser.
This GUI based FTP client makes the file transfer very easy and also does
not require to remember the FTP commands.
Advantages of FTP:
o Speed: One of the biggest advantages of FTP is speed. The FTP is one of the
fastest way to transfer the files from one computer to another computer.
o Efficient: It is more efficient as we do not need to complete all the operations
to get the entire file.
o Security: To access the FTP server, we need to login with the username and
password. Therefore, we can say that FTP is more secure.
o Back & forth movement: FTP allows us to transfer the files back and forth.
Suppose you are a manager of the company, you send some information to
all the employees, and they all send information back on the same server.
Disadvantages of FTP:
o The standard requirement of the industry is that all the FTP transmissions
should be encrypted. However, not all the FTP providers are equal and not
all the providers offer encryption. So, we will have to look out for the FTP
providers that provides encryption.
o FTP serves two operations, i.e., to send and receive large files on a network.
However, the size limit of the file is 2GB that can be sent. It also doesn't
allow you to run simultaneous transfers to multiple receivers.
o Passwords and file contents are sent in clear text that allows unwanted
eavesdropping. So, it is quite possible that attackers can carry out the brute
force attack by trying to guess the FTP password.
o It is not compatible with every system.
E-mail Protocols are set of rules that help the client to properly transmit the
information to or from the mail server. Here in this tutorial, we will discuss various
protocols such as SMTP, POP, and IMAP.
SMTP
SMTP stands for Simple Mail Transfer Protocol. It was first proposed in 1982.
It is a standard protocol used for sending e-mail efficiently and reliably over the
internet.
Key Points:
• SMTP is application level protocol.
• SMTP is connection oriented protocol.
• SMTP is text based protocol.
• It handles exchange of messages between e-mail servers over TCP/IP
network.
• Apart from transferring e-mail, SMPT also provides notification regarding
incoming mail.
• When you send e-mail, your e-mail client sends it to your e-mail server
which further contacts the recipient mail server using SMTP client.
• These SMTP commands specify the sender’s and receiver’s e-mail address,
along with the message to be send.
• The exchange of commands between servers is carried out without
intervention of any user.
• In case, message cannot be delivered, an error report is sent to the sender
which makes SMTP a reliable protocol.
SMTP Commands
1 HELLO
This command initiates the SMTP conversation.
2 EHELLO
This is an alternative command to initiate the conversation. ESMTP
indicates that the sender server wants to use extended SMTP protocol.
3 MAIL FROM
This indicates the sender’s address.
4 RCPT TO
It identifies the recipient of the mail. In order to deliver similar message
to multiple users this command can be repeated multiple times.
5 SIZE
This command let the server know the size of attached message in bytes.
6 DATA
The DATA command signifies that a stream of data will follow. Here
stream of data refers to the body of the message.
7 QUIT
This commands is used to terminate the SMTP connection.
8 VERFY
This command is used by the receiving server in order to verify whether
the given username is valid or not.
9 EXPN
It is same as VRFY, except it will list all the users name when it used
with a distribution list.
IMAP
IMAP stands for Internet Mail Access Protocol. It was first proposed in 1986.
Key Points:
• IMAP allows the client program to manipulate the e-mail message on the
server without downloading them on the local computer.
• The e-mail is hold and maintained by the remote server.
• It enables us to take any action such as downloading, delete the mail without
reading the mail.It enables us to create, manipulate and delete remote
message folders called mail boxes.
• IMAP enables the users to search the e-mails.
• It allows concurrent access to multiple mailboxes on multiple mail servers.
IMAP Commands
1 IMAP_LOGIN
This command opens the connection.
2 CAPABILITY
This command requests for listing the capabilities that the server supports.
3 NOOP
This command is used as a periodic poll for new messages or message status
updates during a period of inactivity.
4 SELECT
This command helps to select a mailbox to access the messages.
5 EXAMINE
It is same as SELECT command except no change to the mailbox is
permitted.
6 CREATE
It is used to create mailbox with a specified name.
7 DELETE
It is used to permanently delete a mailbox with a given name.
8 RENAME
It is used to change the name of a mailbox.
9 LOGOUT
This command informs the server that client is done with the session. The
server must send BYE untagged response before the OK response and then
close the network connection.
POP
POP stands for Post Office Protocol. It is generally used to support a single client.
There are several versions of POP but the POP 3 is the current standard.
Key Points
• POP is an application layer internet standard protocol.
• Since POP supports offline access to the messages, thus requires less internet
usage time.
• POP does not allow search facility.
• In order to access the messaged, it is necessary to download them.
• It allows only one mailbox to be created on server.
• It is not suitable for accessing non mail data.
• POP commands are generally abbreviated into codes of three or four letters.
Eg. STAT.
POP Commands
2 STAT
It is used to display number of messages currently in the mailbox.
3 LIST
It is used to get the summary of messages where each message summary
is shown.
4 RETR
This command helps to select a mailbox to access the messages.
5 DELE
It is used to delete a message.
6 RSET
It is used to reset the session to its initial state.
7 QUIT
It is used to log off the session.
3 POP does not allow search facility. It offers ability to search emails.
4 All the messages have to be It allows selective transfer of
downloaded. messages to the client.
5 Only one mailbox can be created on the Multiple mailboxes can be created
server. on the server.
10 The e-mails are not downloaded Users can view the headings and
automatically. sender of e-mails and then decide to
download.
10 POP requires less internet usage time. IMAP requires more internet usage
time.
E-mail System
Mailer
It is also called mail program, mail application or mail client. It allows us to
manage, read and compose e-mail.
Mail Server
The function of mail server is to receive, store and deliver the email. It is must for
mail servers to be Running all the time because if it crashes or is down, email can
be lost.
Mailboxes
Mailbox is generally a folder that contains emails and information about them.
Working of E-mail
Email working follows the client server approach. In this client is the mailer i.e.
the mail application or mail program and server is a device that manages emails.
Following example will take you through the basic steps involved in sending and
receiving emails and will give you a better understanding of working of email
system:
• Suppose person A wants to send an email message to person B.
• Person A composes the messages using a mailer program i.e. mail client and
then select Send option.
• The message is routed to Simple Mail Transfer Protocol to person B’s mail
server.
• The mail server stores the email message on disk in an area designated for
person B.
The disk space area on mail server is called mail spool.
• Now, suppose person B is running a POP client and knows how to
communicate with B’s mail server.
• It will periodically poll the POP server to check if any new email has arrived
for B.As in this case, person B has sent an email for person B, so email is
forwarded over the network to B’s PC. This is message is now stored on
person B’s PC.
The following diagram gives pictorial representation of the steps discussed above:
Telnet
o The main task of the internet is to provide services to users. For example,
users want to run different application programs at the remote site and
transfers a result to the local site. This requires a client-server program such
as FTP, SMTP. But this would not allow us to create a specific program for
each demand.
o The better solution is to provide a general client-server program that lets the
user access any application program on a remote computer. Therefore, a
program that allows a user to log on to a remote computer. A popular client-
server program Telnet is used to meet such demands. Telnet is an
abbreviation for Terminal Network.
o Telnet provides a connection to the remote computer in such a way that a
local terminal appears to be at the remote side.
Local Login
o When a user logs into a local computer, then it is known as local login.
o When the workstation running terminal emulator, the keystrokes
entered by the user are accepted by the terminal driver. The terminal
driver then passes these characters to the operating system which in
turn, invokes the desired application program.
o However, the operating system has special meaning to special
characters. For example, in UNIX some combination of characters
have special meanings such as control character with "z" means
suspend. Such situations do not create any problem as the terminal
driver knows the meaning of such characters. But, it can cause the
problems in remote login.
Remote login
o When the user wants to access an application program on a remote
computer, then the user must perform remote login.
The user sends the keystrokes to the terminal driver, the characters are then
sent to the TELNET client. The TELNET client which in turn, transforms the
characters to a universal character set known as network virtual terminal
characters and delivers them to the local TCP/IP stack
The commands in NVT forms are transmitted to the TCP/IP at the remote
machine. Here, the characters are delivered to the operating system and then
pass to the TELNET server. The TELNET server transforms the characters
which can be understandable by a remote computer. However, the characters
cannot be directly passed to the operating system as a remote operating
system does not receive the characters from the TELNET server. Therefore
it requires some piece of software that can accept the characters from the
TELNET server. The operating system then passes these characters to the
appropriate application program.
HTTP
Features of HTTP:
HTTP Transactions
The above figure shows the HTTP transaction between client and server. The client
initiates a transaction by sending a request message to the server. The server replies
to the request message by sending a response message.
Messages
HTTP messages are of two types: request and response. Both the message types
follow the same message format.
Request Message: The request message is sent by the client that consists of a
request line, headers, and sometimes a body.
Response Message: The response message is sent by the server to the client that
consists of a status line, headers, and sometimes a body.
o Method: The method is the protocol used to retrieve the document from a
server. For example, HTTP.
o Host: The host is the computer where the information is stored, and the
computer is given an alias name. Web pages are mainly stored in the
computers and the computers are given an alias name that begins with the
characters "www". This field is not mandatory.
o Port: The URL can also contain the port number of the server, but it's an
optional field. If the port number is included, then it must come between the
host and path and it should be separated from the host by a colon.
o Path: Path is the pathname of the file where the information is stored. The
path itself contain slashes that separate the directories from the subdirectories
and files.
Secure Shell (SSH) is a secure application program that can be used today for
several purposes such as remote logging and file transfer; it was originally
designed to replace TELNET.
There are two versions of SSH: SSH-l and SSH-2
Components
SSH Transport-Layer Protocol (SSH-TRANS)
SSH first uses a protocol that creates secured channel on top of the TCP.
When the procedure implementing this protocol is called, the client and server
first use the TCP protocol to establish an insecure connection.
SSH Authentication Protocol (SSH-AUTH)
After a secure channel is established between the client and the server and
the server is authenticated for the client
SSH can call another procedure that can authenticate the client for the
server. The client authentication process in SSH is very similar to what is done
in Secure Socket Layer (SSL)
The request includes the user name, server name, the method of
authentication, and the required data.
The server responds with either a success message, which confirms
that the client is authenticated, or a failed message
The host that needs mapping can contact the closest computer holding the needed
information. This method is used by the Domain Name System (DNS).
A user wants to use a file transfer client to access the corresponding file transfer
server running on a remote host.
The user knows only the file transfer server name, such as afilesource.com.
Name Space
A name space that maps each address to a unique name can be organized in two
ways: flat or hierarchical.
In a flat name space, a name is assigned to an address. A name in this space is a
sequence of characters without structure.
In a hierarchical name space, each name is made of several parts.
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).
Domain Name
If a label is terminated by a null string, it is called a fully qualified domain name
(FQDN).
If a label is not terminated by a null string, it is called a partially qualified domain
name PQDN).
Domain
A domain is a sub tree of the domain name space. The name of the domain is
the name of the node at the top of the sub tree.
Distribution of Name Space
The information contained in the domain name space must be stored.
However, it is very inefficient and also not reliable to have just one computer
store such a huge amount of information. It is inefficient because responding to
requests from all over the world places a heavy load on the system it is not
reliable because any failure makes the data inaccessible.
Zone
Since the complete domain name hierarchy cannot be stored on a single server,
it is divided among many servers. What a server is responsible for or has
authority over is called a zone.
The server makes a database called a zone file and keeps all the information for
every node under that domain.