0% found this document useful (0 votes)
18 views79 pages

Unit - 6 (Application Layer)

Uploaded by

Sushil Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views79 pages

Unit - 6 (Application Layer)

Uploaded by

Sushil Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 79

Computer Networks (Application Layer)

By

Dr. Nand Kumar Jyotish


M.Tech + Ph.D, Indian Institute of
Technology (ISM), Dhanbad
Computer Networks
Course Outline:

√ Overview of Data Communication and Networking


√ Physical Layer
√ Data Link Layer
- Logical Link Control (LLC)
- Medium Access Control (MAC)
√ Network Layer
√ Transport Layer
√ Application Layer
Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
OSI Reference Model Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
OSI Reference Model Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
Application Layer
The application layer enables the user, whether human or software, to
access the network. It provides user interfaces and support for services
such as electronic mail, file access and transfer, access to system resources,
surfing the world wide web, and network management.
• Domain Name Server (DNS)

• Simple Mail Transfer Protocol (SMTP)\Electronic Mail

• Hypertext Transfer Protocol (HTTP)

• File Transfer Protocol (FTP)

• Remote Login (TELNET)


Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
Application Layer
 Domain Name Server (DNS)
• Simple Mail Transfer Protocol (SMTP)\Electronic Mail

• Hypertext Transfer Protocol (HTTP)

• File Transfer Protocol (FTP)

• Remote Login
There are several applications in the application layer of the Internet model that follow the
client/server paradigm. The client/server programs can be divided into two categories: those
that can be directly used by the user, such as e-mail, and those that support other
application programs. The Domain Name System (DNS) is a supporting program that is used
by other programs such as e-mail. Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
Application Layer I Domain Name Server (DNS)
A system that can map a name to an address or an address to a name.

 When the Internet was small, mapping was done using a host file.
Every host could store the host file on its disk and update it periodically
from a master host file. When a program or a user wanted to map a name
to an address, the host consulted the host file and found the mapping.

 Store the entire host file in a single computer and allow


access to this centralized information to every
computer that needs mapping. This would create a
huge amount of traffic on the Internet.

 Divide the huge amount of information into smaller


parts and store each part on a different computer. The
host that needs mapping can contact the closest
computer holding the needed information. This method is
used by the Domain Name System (DNS). Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
DNS | Name Space Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

The names of machine should be unique. A name space that maps each address to a unique name
can be organized in two ways:
• Flat Name Space
A name is assigned to an address. A name in this space is a sequence of characters without structure.

Disadvantage: It cannot be used in a large system such as the Internet because it must be
centrally controlled to avoid any ambiguity and duplication.

• Hierarchical Name Space


Each name is made of several parts [the 1st part can define the nature of the organization, the 2nd
part can define the name of the organization, the 3rd part can define departments in the organization
and so on].
The authority to assign and control the name spaces can be decentralized. A central authority can
assign the part of the name that defines the nature and name of the organization. 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.

The names are unique without the need for assignment by a central authority. The central authority
controls only part of the name, not the whole.
DNS | Domain Name Space Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

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 (0-Root to 127).

Each node in the tree has a domain name. A full domain


Each node in the tree has a LABEL, which is a name is a sequence of labels separated by dots (.). The
string with a maximum of 63 characters. The domain names are always read from the node up to the
ROOT label is a NULL string (empty string). DNS root. The last label is the label of the root (null). This
requires that children of a node have different labels, means that a full domain name always ends in a null
which guarantees the uniqueness of the domain names label, which means the last character is a dot because the
null string is nothing.
DNS | Domain Name Space Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

 Full Qualified Domain Name (FQDN):

• A label is terminated by a NULL string.


• Contains the full name of a host.
• Contains all labels, from the most specific to the most
general, that uniquely defines the name of the host.
• Example: challenge.atc.fhda.edu.

 Partially Qualified Domain Name (PQDN):

• A label is not terminated by a NULL string.


• Starts from a node, but it does no reach the root.
• It is used when the name to be resolved belongs to the same site as the client.
• The resolver can supply the missing part, called the SUFFIX, to create an FQDN.
• Example: If an user at the fhda.edu. site wants to get the IP address of the “Challenger”
computer, s/he can define the partial name: challenger.
DNS | Domain Name Space Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

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.

The solution to these problems is to distribute the


information among many computers called DNS
SERVERS. Each server can be responsible for either a large
or small domain. In other words, we have a hierarchy of
servers in the same way that we have a hierarchy of names.

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.
DNS | Domain Name Space
• If a server accepts responsibility for a domain and does not divide the domain into smaller domains,
the “domain” and the “zone” refer to the same thing. The server makes a database called a ZONE
FILE and keeps all the information for every node under that domain.

• If a server divides its domain into sub-domains and delegates part of its authority to other servers,
“domain” and “zone” refer to different things. The information about the nodes in the sub-domains
is stored in the servers at the lower levels, with the original server keeping some sort of reference to
there lower-level servers.

A ROOT SERVER is a server whose zone consists of the whole tree. A root server usually does not
store any information about domains but delegates it authority to other servers, keeping references
to those servers.

There are several root servers, each covering the whole domain name space. The servers are
distributed all around the world.

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


DNS | Domain Name Space
Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
DNS | Domain Name Space Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

In the Internet, the domain name space is divided into three different sections:

 Generic Domains – Define registered hosts according to their generic behaviour.


uses three-character nature abbreviations.
com – Commercial Organizations
edu – Educational Institutions
gov – Government Institutions
org – Non-profit Organizations
mil – Military Groups

 Country Domains – Follows same format as the generic domains but uses two-character country
abbreviations in place of three-character organizational abbreviation at the first level.
in – India
us – United States of America
au – Australia
fr – France
DNS | Domain Name Space Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

Generic Domains Country Domains


DNS | Domain Name Space Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

 Inverse Domain – Is used to map an address to a name.


• This happen when a server has received a request
from a client to do a task. The server has a file that
contains only the IP address of the authorized clients.

• 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 – Inverse or Pointer
Query.

• The servers that handle the inverse domain are also


hierarchical.

• Netid part of the address should be at a higher level


than the subnetid part, and the subnetid part higher than
the hostid part.

• An IP address such as 132.34.45.121 is read as


121.45.34.132.in-addr.arpa.
DNS | Message Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
DNS has two types of messages:
• Query
• Response

The query message consists of a HEADER and the Question Records.

The response message consists of a HEADER, Question Records, Answer Records, Authoritative
Records, and Additional records.
DNS | Message Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

 Header (12-bytes length) Both query and response messages have the same header format with some
fields set to zero for the query messages.

Identification (16 bits): Used by 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.

Flags (16 bits): 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 sub-field 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.
DNS | Encapsulation Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

DNS can use either UDP or TCP.

In both cases the well-know port used by the server is port 53.

UDP connection is used when the size of the response message is less than 512 bytes
because most UDP packages have a 512-byte packet size limit.

If the size of the response message is more than 512 bytes, a TCP connection is used.

• If the resolver has prior knowledge that the size of the response message is more than 512 bytes,
it uses the TCP connection.

• If the resolver does not know the size of the response message, it can use the UDP connection.
However, if the size of the response message is more than 512 bytes, the server truncates
the message and turns on the TC bit. The resolver now opens a TCP connection and
REPEATS THE REQUEST to get the full response from the server.
Application Layer Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

 Domain Name Server (DNS)

 Simple Mail Transfer Protocol (SMTP)/Electronic Mail

• Hypertext Transfer Protocol (HTTP)

• File Transfer Protocol (FTP)

• Remote Login (TELNET)


Application Layer I Simple Mail Transfer Protocol (SMTP)
One of the most popular network services is Electronic Mail (email).

The TCP/IP protocol that supports email on the Internet is called Simple Mail Transfer Protocol
(SMTP).

SMTP Supports:
• Sending a single message to one or more recipients.
• Sending messages that include text, voice, video or graphics.
• Sending messages to users on networks outside the Internet.

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


Application Layer I Simple Mail Transfer Protocol (SMTP)
SMTP client and server has two components: User Agent (UA) and Mail Transfer Agent (MTA).
User Agent (UA):
Relaying could be involved. Instead of just one
• Prepares the message, MTA at the sender site and one at the receiving
• Create the envelope, and site, other MTAs acting either as client or server,
• Puts the message in the envelope. can relay the mail.

Mail Transfer Agent (MTA) transfers the mail


across the Internet.

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


Application Layer I Simple Mail Transfer Protocol (SMTP)
The relaying system allows sites that do not use the TCP/IP protocol suite to send email to
users on other sites that may or may not use the TCP/IP protocol suite.

This is accomplished through the use of a Mail Gateway, which is a relay MTA that can receive mail
prepared by a protocol other than SMTP and transform it to SMTP format before sending it.

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

It can also receive mail in SMTP format and change it to another format before sending it.
SMTP | Architecture Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

Scenario I:

When the sender and the receiver of an email are on the same mail server, we need only two
UAs.
SMTP | Architecture Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

Scenario II:

When the sender and the receiver of an email are on different mail servers, we need two UAs and
a pair of MTAs (Client and Server).
SMTP | Architecture Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

Scenario III:

When the sender is connected to the mail server via a LAN or a WAN, we need two UAs and
two pairs of MTAs (Client and Server)
SMTP | Architecture Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

Scenario IV:
When both sender and receiver are connected to the mail server via a LAN or a WAN, we need
two UAs, two pairs of MTAs, and a pair of Message Access Agents (MAAs).
SMTP | User Agent Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

Services Provided by a User Agent:


Mail Transfer Agent (MTA): SMTP
• The actual mail transfer is done through MTA

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

POP3 and IMAP4


SMTP | Message Access Agent (MAA)
The SMTP transfer scheme implies that a server must remain ready
to accept email at all times; the client attempts to send a message
as soon as a user enters it.

The scenario works well if the server runs on a computer that has a permanent Internet connection.

How can a user without a permanent connection receive email?


• Each user is assigned a mailbox on a computer that has a permanent Internet connection. The
computer runs a conventional SMTP server, which always remains ready to accept email.
• The user forms a dialup connection, and then runs a protocol that retrieves messages from the
permanent mailbox. The protocol transfers the messages to the user’s computer where they can
be read.

Two protocols exist that allow a remote user to retrieve mail from a permanent mailbox and allows
user to manipulate the mailbox content:
 Post Office Protocol (POP)
Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
 Internet Message Access Protocol (IMAP)
SMTP | Message Access Agent (MAA) Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

 Post Office Protocol (POP)


The user invokes a POP Client, which creates a TCP connection to a POP Server (Port no 110)
on a mailbox computer.
The user first send a login and a password to authenticate the session.
A computer with the permanent mailbox must run two servers:
• An SMTP server to accept mail sent to the user and adds each to the user’s permanent
mailbox.
• POP server allows a user to extract messages from the mailbox and delete them (if
needed).
POP has two modes: the DELETE mode and the KEEP mode.
• In the Delete Mode, the mail is deleted from the mailbox after each retrieval.
• In the Keep Mode, the mail remains in the mailbox after retrieval.

POP Session States:


• Authentication State • Transaction State • Update State
SMTP | Message Access Agent (MAA) Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

 Internet Message Access Protocol (IMAP)

IMAP works by keeping mail on the server. POP works by downloading your mail to your computer.

Like POP, IMAP also defines an abstraction known as a mailbox; mailbox are located on the same
computer as a server.

Like POP, a user runs an IMAP client that contacts the server to retrieve messages.

Unlike POP, IMAP allows a user to dynamically create, delete, or rename mailboxes.

IMAP also provides extended functionality for message retrieval and processing. A user can obtain
information about a message or examine header fields without retrieving the entire message.

A user can search for a specified string and retrieve specified portions of a message.
Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

POP3
SMTP | Addresses Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

To deliver mail, a mail handling system must use an addressing system with unique addresses.

The address consists of two parts: a Local Part and a Domain Name, separated by an @ sign.
SMTP | Commands and Responses
SMTP uses COMMANDS and RESPONSES to transfer messages between an MTA clients and an
MTA server.

 Commands:
The format of a command consists of a keyword followed by zero or more argument.

Keyword: Argument(s)

1. HELO: Sender’s Host Name


Used by client to identify itself.
HELO: iitism.ac.in
2. MAIL FROM: Sender of the Message
Used by client to identify the sender of the message.
Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
MAIL FROM: [email protected]
SMTP | Commands and Responses Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

3. RCPT TO: Intended recipient of the message


RCPT TO: [email protected]
4. DATA: Body of the mail
Used to send the actual message
DATA: Hello! How are you?
5. QUIT
Used to terminate the message
6. VRFY: Name of the recipient to be verified
Used to verify the address of the recipient, which is sent as the argument.
The sender can ask the receiver to confirm that name identifies a valid recipient.
VRFY: [email protected]
7. SEND FROM: Sender of the message
The mail is to be delivered to the terminal of the recipient. If the recipient is not logged
in, the mail is bounced back.
SEND FROM: njyotish@ cse.iitism.ac.in
SMTP | Commands and Responses
8. SMOL FROM: Intended recipient of the message
The mail is to be delivered to the terminal or mailbox of the recipient.
If the Recipient logged in: Mail delivered at the Terminal
If the Recipient is logged out: Mail delivered in the Mailbox

9. SMAL FROM: Intended recipient of the message


The mail is to be delivered to the terminal and mailbox of the recipient.

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


SMTP | Commands and Responses Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

 Responses:

A response is a three-digit code that may be followed by additional textual information.


The meaning of First Digit are:
 2yz (Positive Completion Reply)
Requested command has been successfully completed.
220 – Service Ready
250 – Request Command Complete.
 3yz (Positive Intermediate Reply)
Requested command accepted, but the recipient needs some more information
before completion can occur.
354 – Start Mail Input
SMTP | Commands and Responses Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

 4yz (Transient Negative Completion reply)


Requested command has been rejected.
The error condition is temporary. The command can be sent again.
421 – Service Not Available
450 – Mailbox Not Available
451 – Command Aborted – local error
452 – Command Aborted – insufficient storage.

 5yz (Permanent Negative Completion reply)


Requested command has been rejected.
The command can not be sent again.
500 – Syntax Error (Unrecognized Command)
501 – Syntax Error in parameter or arguments
503 – Bad sequence of Commands.
554 – Transaction Failed.

2nd and 3rd Digit provide further details about the response.
SMTP | Mail Transfer Phases Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

The process of transferring a mail message occurs in three phases:


• Connection Establishment
• Mail Transfer
• Connection Termination

 Connection Establishment

After a client has made a TCP connection to the well known port 25, the SMTP server starts the
connection phase.
SMTP | Mail Transfer Phases
Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

 Mail Transfer
SMTP | Mail Transfer Phases Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

 Connection Termination

After the connection termination phase, the TCP connection must be closed.
Electronic Mail: mail servers

Mail Servers user


agent
• mailbox contains incoming mail
messages for user user
server
agent
• message queue of outgoing (to be
sent) mail messages
SMTP mail
server user
• SMTP protocol between mail
servers to send email messages SMTP agent

• client: sending mail server SMTP


• “server”: receiving mail mail user
server server agent

user
agent
user
Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad) agent
Electronic Mail: SMTP [RFC 2821]
• uses TCP to reliably transfer email message from client to server,
port 25
• direct transfer: sending server to receiving server
• three phases of transfer
• handshaking (greeting)
• transfer of messages
• closure
• command/response interaction
• commands: ASCII text
• response: status code and phrase
• messages must be in 7-bit ASCII

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


Scenario: Alice sends message to
Bob
1) Alice uses UA to compose 4) SMTP client sends Alice’s
message and “to” message over the TCP
[email protected] connection
2) Alice’s UA sends message to her 5) Bob’s mail server places the
mail server; message placed in message in Bob’s mailbox
message queue 6) Bob invokes his user agent to
3) Client side of SMTP opens TCP read message
connection with Bob’s mail
server

1 mail
mail
server user
user server
2 agent
agent 3 6
4 5

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


Application Layer Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

 Domain Name Server (DNS)

 Simple Mail Transfer Protocol (SMTP)/Electronic Mail

 WWW and Hypertext Transfer Protocol (HTTP)

• File Transfer Protocol (FTP)

• Remote Login (TELNET)


Architecture of WWW
• The WWW today is a distributed client/server service, in which a client
using a browser can access a service using a server. However, the service
provided is distributed over many locations called sites.

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


Browser and URL

• Uniform Resource Locator

• Cookies ??
Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
Application Layer I Hypertext Transfer Protocol (HTTP)
World Wide Web (WWW) is a distributed client server service in which a client using a browser can
access a service using a server.

HTTP protocol is used for communication between a browser and a web server or between
intermediate machines and web servers.
Web Documents:
• Static Documents
• Dynamic Documents
• Active Documents Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
HTTP | Transaction Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

HTTP itself is a stateless protocol. It uses the services of TCP (Port 80).

HTTP Request Messages:

Request message consists of a request line, a header and sometimes a body.

 Request Line: Defines the Request Type, Resource (URL) and HTTP Version.

Method (Request Type): Defines several kinds of messages referred to as methods.


The request method is the actual command or request that a client issues to the server.

• GET: Used when a client wants to retrieve a document from the server.
The address of the document is defined in the URL.
The server usually responds with the contents of the document in the body of the response
message.
HTTP | Transaction

• PUT: Used when a client to provide a new or replacement document to


be stored on the server.
The document is included in the body of the request and will be stored in
the location defined by the URL.

• HEAD: Used when a client wants some information about the document but
not the document itself.

• POST: Used when a client provides some information for the server.

• COPY: Used to copy a file to another location.

Source File Location – Request Line (URL)


Destination – Entity Header.

• DELETE: Used to remove a document on the server. Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
HTTP | Transaction

Uniform Resource Locator (URL):

The URL defines four things: Method, Host Computer, Port and Path.

The method is the protocol used to retrieve the document. Like HTTP, FTP, TELNET etc.

The host computer where the information is located. Web pages are usually stored in computers, and
computers are given alias names that usually begin with the character “www”.

Version:
The version of HTTP.

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


HTTP | Transaction
 Headers:

The header exchanges additional information between the client and the
server.
The header can be one or more header lines.
Each header line is made of: Header Name, Colon, Space, Header Value.

Header_Name: space Header_Value

A header line belongs to one of the four categories:


• General header
• Request Header
• Response Header
• Entity Header

A request message can contain only General, Request


and Entity Header.
Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
HTTP | Transaction
General Headers:
It gives general information about the message.
• Cache-control: Specifies information about caching.
• Connection: Shows whether the connection should
be closed or not.
• Date: Shows the current date.

Request Headers:
Specifies the client’s configuration and the client’s preferred document format.
• Accept: Shows the media format the client can accept.
• Accept-charset: Shows the character set the client can handle.
• Authorization: Shows what permissions the client has.
• Host: Shows the host and port number of the client.
Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
• From: Shows the email address of the user.
HTTP | Transaction
Entity Headers:

It gives information about the body of the document.


• Allow: List the valid methods that can be used with a
URL.
• Content-type: Specifies the media type.
• Content-length: Shows the length of the document.
• Expires: Gives the date and time when contents may change.
• Location: Specifies the location of the created or moved document.

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


HTTP | Transaction Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

HTTP Response Messages:


Response message consists of a Status line, a header and sometimes a body.
 Status Line: Defines the status of the response message.
It consists of the HTTP Version, Status Code and Status Phrase.

Status Code:
Similar to those in SMTP.
It consists of three digits:
• Codes in the 100 range are Only Informational. • Codes in the 400 indicate an error at the client
site.
• Codes in the 200 range indicate a Successful Request.
• Codes in the 500 range indicate an error at the
• Codes in the 300 range redirect Client to another URL. server site.
HTTP | Transaction
Status Code:
• 100 – The initial part of the request has been received and the client may continue
with its request.
• 200 – The request is successful.
• 201 – A new URL is created.
• 302 – The requested URL is no longer used by the server.
• 400 – There is a syntax error in the request.
• 403 – Service is denied.
• 500 – There is an error, such as a crash, in the server site.
• 503 – The service is temporarily unavailable, but may be requested in the future.
Status Phrase:
This field explains the status code in the text form.
• 100 – Continue • 403 – Forbidden
• 200 – OK • 500 – Internal Server Error
• 201 – Created • 503 – Service Unavailable
• 302 – Moved Permanently
• 400 – Bad request Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
HTTP | Transaction
A response message can contain only General, Response and Entity Header.

 Response Headers:

Specifies the server’s configuration and special information about the request.
• Accept-range: Shows if server accepts the range requested by client.

• Age: Shows the age of the document.


• Public: Shows the supported list of methods.
• Server: Shows the server name and version number.

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


HTTP | Example Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

Client Server
HTTP | Version Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

 Persistence HTTP (HTTP/1.1)


Server leaves connection open (for some defined time; 125 sec) after sending response.
Server can close the connection at the request of a client or if a time-out has been reached.
Overhead is less.
1 RTT for each referenced object.

 Non-Persistence HTTP (HTTP/1.0)

One TCP connection is made for each request/response.


1. The client opens a TCP connection and sends a request.
2. The server sends the response and closes the connection.
3. The client reads the data until it encounters an EOF marker; it then closes
the connection.
2 RTTs for each referenced object. Imposes high overhead on the server.
Application Layer

 Domain Name Server (DNS)

 Simple Mail Transfer Protocol (SMTP)/Electronic Mail

 WWW and Hypertext Transfer Protocol (HTTP)

 File Transfer Protocol (FTP)

• Remote Login

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


Application Layer I File Transfer Protocol (FTP)
FTP is the standard mechanism provided by TCP/IP for copying a file from one host to another.

FTP establishes two connections between the hosts. One connection is used for DATA TRANSFER
and the other for CONTROL INFORMATION (commands and responses).

The control connection uses very simple rules of communication. The data connection, on the
other hand, needs more complex rules due to the variety of data types transferred.

FTP needs to TCP connections. It uses two


well-known TCP ports: Port 20 is used for
the Data Connection and Port 21 is used for
the Control Connection.

The control connection remains connected


during the entire interactive FTP session.

The data connection is opened and then


closed for each file transferred.
Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
FTP | Connections Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

The two FTP connection, control and data, uses different strategies and different port numbers.

 Control Connection

The connection is created in two steps:


1. The server issues a passive open on the well-known
port 21 and waits for a client.

2. The client uses an ephemeral port and issues an


active open.

The connection remains open during the entire process.


The service type, used by the IP protocol, is MINIMIZE DELAY because this is an interactive
connection between a user and a server.
The client types commands and expects to receive response without significant delay.
FTP | Connections Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
 Data Connection

Uses the well-known port 20 at the server site.

The following shows how FTP creates a data connection:

1. The client issues a passive open using an ephemeral


port.

2. The client sends this port number to the server using


the PORT command.

3. The server receives the port number and issues an


active open using the well-known port 20 and the
received ephemeral port number.
FTP | Communication Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

The FTP client and server, which run on different computers, must communicate with each other.

Both computers may use different operating systems, different character sets, different file structures,
and different file formats. FTP must make this HETEROGENEITY COMPATIBLE.

FTP uses two different approaches, one for the control connection and one for the data connection.

 Communication over Control Connection

FTP uses the same approach as SMTP to


communicate across the control connection.
It uses the NVT ASCII character set.

Each command or response is only one short line so need not to worry about the file format or file
structure.
Each line is terminated with a 2-character (carriage return and line feed) end-of-line token.
FTP | Communication Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

 Communication over Data Connection

The client must define the type of file to be transferred, the structure of the data, and the
transmission mode.
Before sending the file through the data connection, there is a need to prepare for the transmission
through the control connection.

The heterogeneity problem is resolved by defining three attributes of communication: File


Type, Data Structure, and the Transmission Mode.
FTP | Communication Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

File Type:

FTP can transfer one of the following file types across the data connection:
• ASCII: This is the default format for transferring text file.
• EBCDIC
• Image File: This is the default format for transferring binary files.

Data Structure:
FTP can transfer a file across the data connection using one of the following interpretations about
the structure of the data:
• File Structure (Default): The file has no structure. It is a continuous stream of bytes.
• Record Structure: The file is divided into records. This can be used only with text file.
• Page Structure: The file is divided in to pages, with each page having a page number and a
page header. The pages can be stored and accessed randomly or sequentially.
FTP | Communication Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

Transmission Modes:

FTP transfer files using any of the following modes:

• Stream Mode: It is the default mode. Data are delivered from FTP to TCP as a continuous
stream of bytes. TCP is responsible for fragmenting data into appropriate size. The
connection is automatically closed if the transforming data is in the stream of bytes.
Otherwise, the sender will close the connection (by putting EOF character at the end).

• Block Mode: In block mode, the data is transferred from FTP to TCP in the form of blocks,
and each block is preceded by a 3-byte header. The first byte of the block contains the
information about the block (block descriptor) and the other two bytes contain the size of the
block in bytes.

• Compressed Mode: If the file is big, the data can be compressed. The compression
method normally used in run-length encoding.
FTP | Command Processing & File Transfer
 Command Processing

Commands are divided in to six groups:


• Access Commands • Port Defining Commands
• File Management Commands • File Transferring Commands
• Data Formatting Commands • Miscellaneous Commands
 File Transfer

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


FTP | Example 1 Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
FTP | Example 2 Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
FTP | Anonymous FTP
Some sites can enable anonymous FTP whose files are available for public access.

The user can access those files without any username or password.

The username is set to anonymous and the password to the guest by default.

The access of the user is very limited. For example, the user can copy the files but not allowed to
navigate through directories.

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


Trivial FTP (TFPT)
When a diskless workstation or a router is booted, they require to download the bootstrap and
configuration files with minimum overhead.

Trivial File Transfer Protocol (TFTP) is designed for these types of file transfer.

It is so simple that the software package can fit into the read-only memory of a diskless workstation.

TFTP uses the services of UDP on the well-known port 69.

Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)


Application Layer

 Domain Name Server (DNS)

 Simple Mail Transfer Protocol (SMTP)

 WWW and Hypertext Transfer Protocol (HTTP)

 File Transfer Protocol (FTP)

 Remote Login (Telnet)


Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
Application Layer I Remote Login Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

Allow the user to log on to a remote computer. After logging on, a user can use the services
available on the remote computer and transfer the results back to the local computer.

TErminaL NETwork (TELNET) is one of such a client-service program. This is the standard TCP/IP
protocol for virtual terminal service.

TELNET enables the


establishment of a
connection to a remote
system in such a way
that the local terminal
appears to be a
terminal at the remote
system.
TELNET| Network Virtual Terminal (NVT) Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

The mechanism to access a remote computer is complex. This is because every computer and its
operating system accepts a special combination of characters as tokens.

Example: EOF token in a computer running the DOS is Ctrl+z, while the UNIX recognizes Ctrl+d.

If we want to access any remote computer in the world, we must first know what type of computer
we will be connected to, and we must install the specific terminal emulator used by that computer.

TELNET solves this problem by defining a universal interface called the Network Virtual Terminal
(NVT) character set.

Via NVT, the client TELNET translates


characters (data or commands) that come
from the local terminal into NVT form and
delivers them to the network.
The server TELNET, on the other hand,
translates data and commands from NVT
form into the form acceptable by the remote
computer.
TELNET| Network Virtual Terminal (NVT)
NVT uses two sets of characters, one for DATA and one for CONTROL. Both are 8-bit bytes.

Data Character:

This is an 8-bit character set in which the seven lowest order bits are the same as ASCII and the
highest order bit is 0.

Control Character:
Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)
This is an 8-bit character set in which the highest order bit is 1.
TELNET| Embedding Dr. Nand Kr. Jyotish, IIT-ISM (Dhanbad)

TELNET uses only one TCP connection. Same connection is used for sending both data and
control.
The server uses the well-known port 23 and the client uses an ephemeral port.
TELNET accomplishes this by embedding the control characters in the data stream. However, to
distinguish data from control characters, each sequence of control characters is preceded by a special
control character called Interpret As Control (IAC).

Example:
Imagine a user wants a server to display a file (named “file1”) on a remote server. Command used is
cat filea.
The user uses the backspace key to correct this situation:
cat filea<backspace>1

User cannot edit locally, the editing is done at the remote server.
The backspace character is translated into two remote characters
(IAC EC), which is embedded in the data and sent to the remote
server.
[IAC – Interpret as Control: 11111111 = 255] [EC – Erase Character Command: 11110111 = 247]

You might also like