You are on page 1of 67

SRI KRISHNA COLLEGE OF TECHNOLOGY

(AN AUTONOMOUS INSTITUTION)


KOVAIPUDUR, COIMBATORE-641042

DEPARTMENT OF CSE

COURSE CODE : 22IT402

COURSE TITLE : Networking and Communication

FACULTY NAME : Ms.A.Gomathy, AP/CSE

ACADEMIC YEAR : 2023 - 2024 (Even Semester)


Session 3.6

Module 3 - TRANSPORT LAYER AND APPLICATION LAYER

3.1 Transport Layer: UDP


TCP, Connection establishment and termination, sliding
3.2
window revisited

3.3 Flow and congestion control, timers, retransmission

3.4 Socket Programming

3.5 Application Layer: DNS

3.6 E-Mail -SMTP, MIME, POP3, IMAP

3.7 FTP, HTTP,WWW

3.8 Design issues in protocols at different layers.


Module 3 Transport Layer and Application Layer
Session 3.6
Topics Discussed in the Section
 First Scenario
 Second Scenario
 Third Scenario
 Fourth Scenario

Module 3 Transport Layer and Application Layer


Session 3.6

Figure First scenario

2
1

Module 3 Transport Layer and Application Layer


Session 3.6

Note

When the sender and the receiver of an


e-mail are on the same mail server,
we need only two user agents.

Module 3 Transport Layer and Application Layer


Session 3.6

Figure Second scenario

5
1

2 3 4

Module 3 Transport Layer and Application Layer


Session 3.6

Note

When the sender and the receiver of an


e-mail are on different mail servers,
we need two UAs and a pair of MTAs
(client and server).

Module 3 Transport Layer and Application Layer


Session 3.6

Figure Third scenario

3
7

5
4 6

Module 3 Transport Layer and Application Layer


Session 3.6

Note

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).

Module 3 Transport Layer and Application Layer


Session 3.6

Figure Fourth scenario

1 9

2
8

5
4 6

Module 3 Transport Layer and Application Layer


Session 3.6

Note

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). This is the
most common situation today.

Module 3 Transport Layer and Application Layer


Session 3.6

Figure Push versus pull

Module 3 Transport Layer and Application Layer


Session 3.6

3.6.2 USER AGENT

The first component of an electronic mail system is the


user agent (UA). It provides service to the user to
make the process of sending and receiving a message
easier.

Module 3 Transport Layer and Application Layer


Session 3.6

Topics Discussed in the Section


 Services Provided by a User Agent
 User Agent Types
 Sending Mail
 Receiving Mail
 Addresses
 Mailing List or Group List

Module 3 Transport Layer and Application Layer


Session 3.6

Note

Some examples of command-driven


user agents are mail, pine, and elm.

Module 3 Transport Layer and Application Layer


Session 3.6

Note

Some examples of GUI-based user


agents are Eudora, Outlook,
And Netscape.

Module 3 Transport Layer and Application Layer


Session 3.6

Figure Format of an email

Module 3 Transport Layer and Application Layer


Session 3.6

Figure E-mail address

Module 3 Transport Layer and Application Layer


Session 3.6

3.6.3 MESSAGE TRANSFER AGENT

The actual mail transfer is done through message


transfer agents (MTAs). To send mail, a system must
have the client MTA, and to receive mail, a system must
have a server MTA. The formal protocol that defines
the MTA client and server in the Internet is called
Simple Mail Transfer Protocol (SMTP). As we said
before, two pairs of MTA client-server programs are
used in the most common situation (fourth scenario).
Figure 23.8 shows the range of the SMTP protocol in
this scenario.

Module 3 Transport Layer and Application Layer


Session 3.6

Topics Discussed in the Section


 Commands and Responses
 Mail Transfer Phases

Module 3 Transport Layer and Application Layer


Session 3.6

Figure SMTP range

Module 3 Transport Layer and Application Layer


Session 3.6

Figure Commands and responses

Module 3 Transport Layer and Application Layer


Session 3.6

Module 3 Transport Layer and Application Layer


Session 3.6
Session 3.6

Figure Connection establishment

220 service ready 1


2 HELO: deanza.edu

250 OK 3

Module 3 Transport Layer and Application Layer


Session 3.6
Figure Message transfer

Module 3 Transport Layer and Application Layer


Session 3.6

Figure Connection termination

1 QUIT

221 service closed 2

Module 3 Transport Layer and Application Layer


Session 3.6

3.6.4 MESSAGE ACCESS AGENT

The first and the second stages of mail delivery use


SMTP. However, SMTP is not involved in the third
stage because SMTP is a push protocol; it pushes the
message from the client to the server. In other words,
the direction of the bulk data (messages) is from the
client to the server. On the other hand, the third stage
needs a pull protocol; the client must pull messages
from the server. The direction of the bulk data are
from the server to the client. The third stage uses a
message access agent.

Module 3 Transport Layer and Application Layer


Session 3.6

SMTP
 Originated in 1982 (rfc0821, Jon Postel)
 Goal: To transfer mail reliably and efficiently

Module 3 Transport Layer and Application Layer


Session 3.6

SMTP
 SMTP clients and servers
have two main
components
 User Agents – Prepares the
message, encloses it in an
envelope. (Eudora for
example)
 Mail Transfer Agent –
Transfers the mail across
the internet

Module 3 Transport Layer and Application Layer


Session 3.6

SMTP
 SMTP also allows the use of Relays allowing other
MTAs to relay the mail
 Mail Gateways are used to relay mail prepared by a
protocol other then SMTP and convert it to SMTP

Module 3 Transport Layer and Application Layer


Session 3.6

What is Mail?
 Mail is a text file
 Envelope –
 sender address
 receiver address
 other information
 Message –
 Mail Header – defines the sender, the receiver, the
subject of the message, and some other information
 Mail Body – Contains the actual information in the
message

Module 3 Transport Layer and Application Layer


Session 3.6
Return-Path: <Jwatson@cis.udel.edu>
Post Office
Delivered-To: jwatson@cis.udel.edu
Mailbox

Received: by mail.eecis.udel.edu (Postfix, from userid 62)


id 17FBD328DE; Wed, 5 Nov 2003 11:27:02
Received: from mail.acad.ece.udel.edu
(devil-rays.acad.ece.udel.edu [128.4.60.10])
by mail.eecis.udel.edu (Postfix) with ESMTP id
5F41832893 for <Jwatson@cis.udel.edu>; Wed, 5 Nov 2003
Post office 11:27:01
Received: by mail.acad.ece.udel.edu (Postfix, from userid 62)id
and mail 47509456C; Wed, 5 Nov 2003 11:27:01
Received: from stimpy.eecis.udel.edu(stimpy.eecis.udel.edu
route [128.4.40.17])by mail.acad.ece.udel.edu (Postfix) with SMTP id
7C2943D79 for <Jwatson@cis.udel.edu>; Wed, 5 Nov 2003
11:26:34
Message-Id:
Receivers <20031105162634.7C2943D79@mail.acad.ece.udel.edu>
Date: Wed, 5 Nov 2003 11:26:34
Mailbox From: Jwatson@cis.udel.edu
To: undisclosed-recipients: ;

MIME-Version: 1.0

This is a test.
Module 3 Transport Layer and Application Layer
Session 3.6

How SMTP works (A-PDU’s)

 The Essentials

Keyword Arguments
HELO Sender’s Host Domain Name
MAIL FROM: Email Address of sender
RCPT TO: Email of Intended recipient
DATA Body of the message
QUIT

Module 3 Transport Layer and Application Layer


Session 3.6

How SMTP works (A-PDU’s)

 The Extras

Keyword Arguments
RSET
VRFY Name to be verified
NOOP
TURN
EXPN Mailing list to expand
HELP Command Name

Module 3 Transport Layer and Application Layer


Session 3.6

Status Codes

 The Server responds with a 3 digit code


that may be followed by text info
 2## - Success
 3## - Command can be accepted with
more information
 4## - Command was rejected, but error
condition is temporary
 5## - Command rejected, Bad User!

Module 3 Transport Layer and Application Layer


Session 3.6

Connection Establishment

TCP Connection
Establishment

Module 3 Transport Layer and Application Layer


Session 3.6

Message Progress

Module 3 Transport Layer and Application Layer


Session 3.6

Connection Termination

TCP Connection Termination

Module 3 Transport Layer and Application Layer


Session 3.6

Problems with SMTP

 No security
 Authentication
 Encryption
 Current Solutions:
 VRFY command
 Signature
 Only uses NVT 7 bit ASCII format

Module 3 Transport Layer and Application Layer


Session 3.6

E-mails can be
HELO stimpy.eecis.udel.edu
forged…..
MAIL FROM: carberry@cis.udel.edu
RCPT TO: amer@cis.udel.edu
DATA
From: Dr. Sandra Carberry
To: Dr. Paul Amer
Subject: CISC856

Dr. Amer,
By department decree all students in your CISC856
TCP/IP class are hereby to be given automatic A’s.
Thank you,
Dr. M. Sandra Carberry
.
QUIT

Module 3 Transport Layer and Application Layer


Session 3.6

Extensions to SMTP
 MIME – Multipurpose Internet Mail Extensions
 Transforms non-ASCII data to NVT (Network Virtual Terminal)
ASCII data
 Text
 Application
 Image
 Audio
 Video

Module 3 Transport Layer and Application Layer


Session 3.6

MIME Headers

 Goes between the Email Header and Body


 MIME-Version: 1.1
 Content-Type
 Content-Transfer-Encoding
 Content-Id
 Content-Description

Module 3 Transport Layer and Application Layer


Session 3.6

MIME Headers

 Content-Type – Type of data used in the


body of the message
 Text – plain, unformatted text; HTML

 Multipart – Body contains multiple

independent parts
 Message – The body is whole mail

message, part of a
message, or a pointer to a
message

Module 3 Transport Layer and Application Layer


Session 3.6

MIME Headers

 Image – The message is a stationary


image (JPEG or GIF)
 Video – The message is an animation
(Mpeg)
 Audio – The message is 8 kHz standard
audio data
 Application – The message is a type of
data not previously defined

Module 3 Transport Layer and Application Layer


Session 3.6

MIME Headers

 Content-Transfer-Encoding – The method


used to encode the messages
 7 bit – no encoding needed
 8 bit – Non-ASCII, short lines
 Binary – Non-ASCII, unlimited length lines
 Base64 – 6 bit blocks encoded into 8-bit ASCII
 Quoted-printable – send non-ASCII characters as
3 ASCII characters, =##, ## is the
hex representation of the byte

Module 3 Transport Layer and Application Layer


Session 3.6

Base64 Encoding

 Divides binary data into 24 bit blocks


 Each block is then divided into 6 bit chunks
 Each 6-bit section is interpreted as one
character (Table 22.5 in Text), 25% overhead
11001100 10000001 00111001

110011 001000 000100 111001


(51) (8) (4) (57)
(z) (I) (E) (5)
01111010 01001001 01000101 00110101
Module 3 Transport Layer and Application Layer
Session 3.6

Quoted-Printable Encoding

 Used when the data has a small non-ASCII portion


 Non-ASCII characters are sent as 3 characters
 First is ‘=‘, second and third are the hex
representation of the byte

01001100 10011101 00111001

(=) (9) (D)


00111101 00111001 01000100

Module 3 Transport Layer and Application Layer


Session 3.6

MIME Headers

 Content-Id – Uniquely identifies the whole


message in a multiple message
environment
 Content-Description – defines whether the
body is image, audio, or video

Module 3 Transport Layer and Application Layer


Session 3.6
A Multipart, Encoded MIME Message
From: joe_luthier@plucknplay.com
To: lchae@mfi.com
Subject: Info on Gibson guitar
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=17

- 17
Content-Type: text/enriched; charset="us-ascii"
Content-Transfer-Encoding: 8bit
Content-Description: Greetings
As promised, I'm getting back to you about the Gibson Southern Jumbo guitar
you were
Interested in. I've enclosed a spec sheet on the guitar, which is in Microsoft
Word.

I guarantee that you'll love it!

- 17
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
Content-Description: Spec sheet saved as MS Word file
Module 3 Transport Layer and Application Layer
Session 3.6

MIME Example
Date: Wed, 04 Apr 2001 00:11:37 -0400
From: Meghna Naik <mnaik@UDel.Edu>
MIME-Version: 1.0
To: stoweg@hotmail.com
Subject: =?gb2312?B?1tDOxA==?= title
Content-Type: text/plain; charset=gb2312
Content-Transfer-Encoding: 7bit

a body text, blah, blah

Module 3 Transport Layer and Application Layer


Session 3.6

Mail Transfer Agents


 MTAs do the actual mail transfers
 MTAs are not meant to be directly
accessed by users.
 MMDF
 SENDMAIL

Module 3 Transport Layer and Application Layer


Session 3.6

Mail Access Protocols

 The MTAs place the email in the user’s


mailbox
 The Mail Access Protocols are used by
the users to retrieve the email from the
mailbox
 POP3
 IMAP4

Module 3 Transport Layer and Application Layer


Session 3.6

Topics Discussed in the Section


 POP3
 IMAP4

Module 3 Transport Layer and Application Layer


Session 3.6

Figure Pop3 and IMAP4

Module 3 Transport Layer and Application Layer


Session 3.6

Figure Pop3

Module 3 Transport Layer and Application Layer


Session 3.6

3.6.5 MIME

Electronic mail has a simple structure. Its simplicity,


however, comes with a price. It can send messages only in
NVT 7-bit ASCII format. In other words, it has some
limitations. 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 to be sent through the
Internet. The message at the receiving site is transformed
back to the original data.

Module 3 Transport Layer and Application Layer


Session 3.6

Topics Discussed in the Section


 MIME Headers

Module 3 Transport Layer and Application Layer


Session 3.6

Figure MIME

Module 3 Transport Layer and Application Layer


Session 3.6

Figure MIME header

Module 3 Transport Layer and Application Layer


Session 3.6

Module 3 Transport Layer and Application Layer


Session 3.6

Module 3 Transport Layer and Application Layer


Session 3.6

Figure Base64

Module 3 Transport Layer and Application Layer


Session 3.6

Module 3 Transport Layer and Application Layer


Session 3.6

Figure Quoted printable

Module 3 Transport Layer and Application Layer


Session 3.6

Figure Web-based e-mail, case 1

1
HTTP
transactions
3
2 4

Module 3 Transport Layer and Application Layer


Session 3.6

Figure Web-based e-mail, case 2

HTTP HTTP
transactions transactions

1 2 3

Module 3 Transport Layer and Application Layer

You might also like