[go: up one dir, main page]

0% found this document useful (0 votes)
8 views31 pages

Application Layer

Uploaded by

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

Application Layer

Uploaded by

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

Electronic Mail

Four Scenarios:

1. First Scenario: The sender and receiver of email are used on the same
system, they are directly connected to a shared system. A mailbox is part of a
local hard drive, a special file with permission restrictions. The administrator
has created one mailbox for each user where the received messages are
stored.

When Alice sends a message to Bob, she runs a user agent program to
prepare the message and store it in Bob’s mailbox. Bob can retrieve and read the
contents of his mailbox at his convenience using a user agent. When the sender
and receiver of an email are on the same system, we need only two user agents.

2. Second Scenario: The sender and receiver of the e-mail are users of two
different systems. The message is sent over the internet. User agents (UAs)
and message transfer agents (MTAs) are needed.
➔ Alice uses a user agent program to send her message to the system at
her own site. The system(mail server) at her site uses a queue to store
messages waiting to be sent.
➔ Bob also needs a user agent program to retrieve messages stored in
the mailbox of the system at his site.
➔ Here two message transfer agents are needed as communication
happens through the internet.
➔ The server needs to run all the time because it does not know when a
client will ask for a connection.
➔ The client can be alerted by the system when there is a message in
the queue to be sent
➔ When sender and receiver of an email are on different systems, we
need two UAs and a pair of MTAs (client and server)

3. Third Scenario: Bob is directly connected to his system. Alice is separated


from her system, either Alice is connected to the system via a point-to-point
WAN or she is connected to a LAN in an organization that uses one mail
server for handling e-mails.
➔ 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).
➔ The system of Alice’s site queues all messages received. It then uses
an MTA client to send the messages to the system of Bob’s site. The
system receives the message and stores it in Bob’s mailbox. Bob uses
his user agent to retrieve the message and read it.

4. Fourth Scenario - Bob is also connected to his mail server by a WAN or a


LAN.
➔ After message has arrived at Bob’s mail server, bob needs to retrieve
it. Here we need another set of agents, message access agents. Bob
uses 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.
➔ MTA client/server program is a push program, the client pushes the
message to the server. Bob needs a pull program.
➔ 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 (client and
server), and a pair of MAAs(client and server).
Terms

1. User Agent: First component of an electronic mail system is the user agent. It
provides service to the user to make the process of sending and receiving
messages easier.
Two types of user agents:
● Command Driven: Early days of email. Still present as underlying. Accepts
one-character command to perform its task. For eg, r to reply to sender or R
to sender and all recipients. Examples of command driven user agents are
mail, pine and elm
● GUI Based: GUI components that allow user to interact with software by
using keyboard and mouse. Eg. Eudora, Outlook, Netscape.

Sending a Mail
To send mail, the user, through the UA, creates a mail that looks very similar to
postal mail.

Envelope: contains the sender and receiver address


Body: contains header and body. Header defines sender, receiver, subject and some
other info. Body contains actual info.
Receiving Mail: User agent is triggered by the user (or timer). If user has a mail, the
UA informs user with notice
- List with message subject and summary is then displayed to the user.

Addresses
Unique addresses must be used. They have two parts:

An organization selects one or more hosts to receive and send email, the hosts are
sometimes called mail servers or exchangers. The domain name assigned to the
mail exchanger either comes from DNS or is a logical name (name of organization)

MIME
Email can send messages only in NVT 7-bit ASCII format. Cannot be used for other
languages or send binary files or video or audio data.

Multipurpose Internet Mail Extensions (MIME) is a supplementary protocol that


allows non-ASCII data to be sent through e-mail. MIME transforms non-ASCII data
at the sender site to NVT ASCII data and delivers it to the client MTA. Message at
receiving side is transformed back to original data.
Content id uniquely identifies the whole message in a multiple-message
environment.
Simple Mail Transfer Protocol (SMTP):
➔ Actual mail transfer is done through message transfer agents
➔ To send mail, a system must have a client MTA, and to receive mail a system
must have a server MTA.
➔ Protocol that defines MTA client and server in the Internet is called Simple
Mail Transfer Protocol (SMTP)

➔ It is used two times, between sender and sender’s mail server and between
the two mail servers
➔ SMTP defines how commands and responses must be sent back and forth
➔ Port number - 25

The first five commands are mandatory; every implementation must support these
5 commands.
The next 3 are often used and highly recommended.
Response is a 3 digit code that may be followed by additional textual information.
Mail transfer phases

Message Access Agent: POP and IMAP


SMTP is not involved in the third stage because SMTP is a push protocol. The third
stage needs a pull protocol.
- The third stage uses a message access agent.
POP3
- It is simple but limited in functionality
- Client POP3 installed in the recipient computer, server POP3 installed on
mail server

Mail access starts with client when user needs to download email from mailbox on
mail server. Client opens a connection to the server on TCP port 110. It then sends
it username and password to access the mailbox. The user can then list and retrieve
the mail messages, one by one.
Delete mode is normally used when user is working at her permanent computer
and can save and organize the received mail after reading or replying

Keep mode is normally used when user accesses her mail away from her primary
computer. Mail is read but kept in system for later retrieval and organizing

IMAP4
File Transfer Protocol
Problems with transferring files:
➔ Two systems may use different file name conventions
➔ Two systems may have different directory structures

FTP establishes two connections between the hosts. One connection is used for
data transfer, and the other is for control information (commands and responses).
● Separation of commands and data transfer makes FTP more efficient.
● Control connection uses very simple rules of communication. We need to
transfer only a line of command or a line of response at a time.
● The data connection, on the other hand, needs more complex rules due to
the variety of data types transferred.
● FTP uses the services of TCP. It needs two TCP connections. The well-known
port 21 is used for the control connection and the well-known port 20 for the
data connection.
The client has three components: the user interface, the client control process, and
the client data transfer process.
Server has two components: server control process and server data transfer
process.
- Control connection is made between the control processes.
- Data connection is made between data transfer processes.

The control connection remains connected during the entire interactive FTP session.
Data connection is opened and then closed for each file transferred.

When a user starts an FTP session, the control connection opens. While the control
connection is open, the data connection can be opened and closed multiple times if
several files are transferred.
Communication over Control Connection
FTP uses the 7-bit ASCII character set. Communication is achieved through
commands and responses. Each command or response is a short line and is
terminated with a two-character end-of-line token.

Communication over Data Connection


File transfer occurs over the data connection under the control of the commands
sent over the control connection. File transfer in FTP means:

● A file is to be copied from the server to the client. This is called retrieving a
file. It is done under the supervision of the RETR command.
● Client to server. Storing a file. STOR command.
● A list of directories of file names is to be sent to the client. LIST command.
FTP treats a list of directories or file names as a file. It is sent over the data
connection
File Type
- FTP can transfer ASCII file, EBCDIC file, or image file.
- ASCII is default format
- If one or both end of connection use EBCDIC encoding (the file format used
by IBM), the file can be transferred using EBCDIC encoding
- Image file is the default format for transferring binary files. It is sent as
continuous streams of bits without any interpretation or encoding. It is mostly
used to transfer binary files such as compiled programs
● For stream mode, if data are simply a stream of bytes(file structure), no
end-of-file is needed. End-of-file is closing of data connection by sender in
this case
● If data is divided into records, each record will have a 1-byte end-of-record
(EOR) character and the end of the file will have a 1-byte end-of-file (EOF)
character.
● Run-length Encoding - consecutive appearances of a data unit are replaced
by one occurrence and the number of repetitions. In a text file, this is usually
blank space. In a binary file, null characters are usually compressed.
World Wide Web
- It is a repository of information linked together from points all over the world
- The WWW has a unique combination of flexibility, portability and user
friendly features that distinguish it from other services provided by Internet

Architecture of WWW
WWW is distributed client/server service, in which a client using a browser can
access a service using a server.
- The service provided is distributed over many location called sites
- Each site holds one or more documents, referred to as Web pages

➔ The client needs to see some information on site A. It sends a request to its
browser to a program that is designed to fetch Web documents.
➔ The request includes the address of the site and the Web page called URL
➔ The server at site A finds the document and sends it to the client
➔ User while viewing the document finds some references to other documents
including a Web page at site B.
➔ User clicks on the URL and client sends another request to the new site and
the new page is retrieved

Client
Variety of vendors offer commercial browsers that interpret and display a Web
document, and all use nearly same architecture
Server
Web pages are stored on the server.
To improve efficiency, servers normally store requested files in a cache in memory;
memory is faster to access than disk.
Servers can also become efficient through multithreading or multiprocessing.

Uniform Resource Locator


Standard for specifying any kind of information on the Internet. It defines four
things: protocol, host computer, port, path
Protocol - client/server program to retrieve document, HTTP/FTP
Host - computer on which info is located
Port - port number of server (optional)
Path - file where info is located

Cookies
WWW originally was a stateless entity. Client sends request and server responds.
Today web performs other purposes:
- Some websites need to allow access to registered clients only
- Websites are being used as electronic stores that allow users to browse
through the store, select wanted items, put them in electronic cart, and pay
at the end
- Some websites are portals: user selects web pages he wants to see
- Some are for advertising

Cookie mechanism was devised.

Creation and Storage of Cookies


➔ When a server receives a request from a client, it stores information in a file
or string. It may include domain name of client, contents of cookie (info server
has gathered about client such as name, registration number etc), a
timestamp etc
➔ Server includes cookie in response sent back to client
➔ When client receives response, browser stores the cookie in cookie directory
which is sorted by domain server name

Using Cookies
➔ When a client sends a request to the server, the browser looks in the cookie
directory to see if it can find a cookie sent by that server.
➔ If found, cookie is included in request
➔ When the server receives the request, it knows that it is an old client.
Cookies are not used or disclosed to users. It is made and eaten by server
Web Documents

HTTP
- protocol used to access data from www
- HTTP functions are a combination of FTP and SMTP
- Similar to FTP because it transfers files and uses the services of TCP, but
much simpler
- Like SMTP because the data transferred looks like SMTP messages. Format
of messages is controlled by MIME-like headers
- HTTP messages are not read by humans; they are read and interpreted by
HTTP server and client.
- SMTP messages are stored and forwarded, HTTP messages are delivered
immediately
- HTTP uses services of TCP on well-known port 80

HTTP Transaction
Although HTTP uses services of TCP, HTTP is a stateless protocol. The client
initialises the transaction by sending a request message
Messages
A request message consists of a request line, a header, and sometimes a body. A
response message consists of a status line, header, and sometimes a body

The first line in a request message is called a request line


The first line in response message is called a status line

Request Type
Version - current version of HTTP is 1.1
Status Code - This field is used in response messages. Consists of 3 digits. Codes in
range of 100 are only informational, codes in 200 range indicate successful request.
Codes in range 300 redirect clients to another URL, and codes in 400 range indicate
an error at client site. Codes in 500 range indicate error in server site
Status Phrase - Used in response message. It explains status code in text form
Body - can be present in a request or response message. Usually, it contains the
document to be sent or received

Non-persistent Connection
TCP connection made for each request/response
- Client opens a TCP connection and sends a request
- Server sends the response and closes the connection
- Client reads data until it encounters an end-of-file marker, then closes the
connection
Imposes high overhead because server needs N different buffers and requires a
slow start procedure each time a connection is opened

Persistent Connect
HTTP 1.1 specifies it by default
Serves leaves connections open for more requests after sending a response. Server
closes the connection at the request of the client or if time-out is reached.
HTTP FTP

It stands for HyperText It stands for File Transfer


Transfer Protocol. Protocol

It is the set of rules that how It the set of rules that permit
web pages are transferred downloading and uploading
on different computers over the files on the computer
the internet over the internet

It supports both data


It only supports the data
connection and control
connection.
connection

It uses Transmission Control It uses Transmission Control


Protocol and runs on TCP Protocol and runs on TCP
port 80. port 20 and TCP port 21.

The URL using the HTTP


The URL using the FTP will
protocol will start with
start with FTP.
HTTP.

It does not require


Requires authentication
authentication

It is efficient in transferring It is efficient in transferring


small files. large files.

The files transferred to the The files transferred to the


computer over the internet computer over the internet
are not saved to the memory. are saved to the memory.

HTTP is used to provide the FTP is used to upload or


web pages to the web download files between
browser from the web server client and server.
It is not a stateless protocol
It is a stateless protocol.
and it maintains states.

It uses a Persistent TCP


It can use both types of connection for the Control
Persistent and connection and a
Non-persistent TCP Non-persistent TCP
connection. Connection for Data
Connection.

It uses a one way It uses a two way


communication system. communication system.

FTP is slower as compared


HTTP is faster.
to HTTP.

Domain Name System


Difference between SSL and SSH
Difference between SSH and SSL - GeeksforGeeks

You might also like