application layer
application layer
NAMESPACE
● W e m ust a ssign a uniqu e na m e to ea ch IP a dd ress so th a t m a pp ing b ec om e possib le
● Se t of a ll th ese u niqu e na m es w h ich a re a ssig ne d to IP a ddre ss a re ca lled na m e spa ce
● For ex am p le, th e d om a in na m e
challenger.atc.fuda.edu.
● N o te t ha t th e na m e m ust end w ith a nu ll la b el, bu t be ca u se nu ll m e a ns noth ing, th e lab el ends w ith a dot (.
).
In th e Inte rnet, th e do m a in na m e spa c e (tre e) is d ivided into th ree different sec tions:
1. Generic domains
2. Country domains
3. Inverse domain
NOTE:
H e re arpa , org , co m , in ... a ll th e se a re c alled a s top level domains.
Generic Domains
● T h e generic domains d efine registere d h osts a cco rding to the ir gene ric beh a v iou r.
● T h e first lev el in th e ge ne ric do m ains sec tion allow s14 p ossib le la be ls.
● T h ese la be ls d escribe th e o rga niz a tion ty pes a s liste d in T a ble be low .
Country Domains
● T h e c ou ntry d om a ins se ctio n u ses tw o-ch a ra cte r c ou ntry a bb rev ia tio ns (e .g ., in for India , us fo r U nite d
S ta tes). Se co nd la b els ca n be org a niza tiona l, or th ey ca n be m ore spe cific , na tiona l designa tions.
● T h e U nited Sta te s, for e xa m ple, u se s sta te ab bre via tions a s a su b div isio n of u s (e.g., ca .u s for
C a lifornia sta te in U S A ).
● Y e t a noth er ex a m ple ca n b e th e a dd ress w w w .a m a zon.in c a n be tra nsla ted to orga niz a tion a m a z on in
india .
Inverse Domain
● T h e inve rse d om a in is u sed to m a p a n a ddre ss to a na m e .
● T h is m a y h a pp en, for e xa m p le, w h en a se rv er h a s re ce iv ed a req ue st from a c lie nt to do a ta sk.
● A lth ou gh th e serv er h as a file th at co nta ins a list of a u th oriz ed clients, o nly th e IP ad dre ss of th e client
(e xt rac ted fro m th e rec eiv ed IP pa cke t) is listed.
● T h e se rve r a sks its reso lv er to send a qu e ry to th e D N S serv er to m a p a n a ddre ss to a na m e to de term ine
if th e client is on th e a u th oriz ed list .
● T h is typ e o f q u ery is c alled a n inv erse or pointe r (PT R) qu e ry.
● T o h a ndle a p ointe r qu e ry, w e h a ve only one top le ve l (first le ve l) dom a in kno w n a s arpa.
● It w a s t he first d om a in in D N S . O riginally it w a s c a lle d Advance Research Project Agency b ut now it is
ca lled Address and Routing Parameter Area.
● A t se co nd le ve l 2 do m ains a re u se d for inve rse m a p ping i.e. in-a ddr(fo r inv erse a dd ress) a nd ip 6.
● is u sed fo r IPV 4 a nd ip 6 is u sed fo r IPV 6.
DISTRIBUTION OF NAMESPACE
● It m ea ns th a t ho w th is h u ge am o u nt of inform a tion is distribu te d o ve r serv ers.
● P a rt of tree m a na ge d by serv er is c a lle d its zone and it is a lw a ys contiguous pa rt of tree .
● W e h a ve not stored th is entire inform a tion at one pla c e to a vo id single po int o f fa ilu re a nd re spond ing
req u est from a ll o ve r th e w orld plac es h ea vy loa d on syst em .
TYPES OF SERVERS
1. Non Authoritative
2. Authoritative
Non Authoritative
● It h a s no DNS database i.e . it h a s no entry for IP a dd ress and na m e for a ny orga niz a tion.
● It is also kno w n a s cache only servers b ec a use to serv ic e a ny q u ery the y u se s th eir ca c he o r a sk oth e r
serv ers th e sa m e qu e ry or refer th e D N S client to som e oth er serv er.
● Ex a m ple is root server a nd it is type of se rve r w h o's z one is e ntire D N S tre e. A c tu ally it do es no t store
a ny inform a tio n a bou t d om a in b u t it st ores th e IP a ddre ss of d iffere nt serv ers w h ose zo ne is top le ve l
do m ain. Th e re a re se ve ral roo t serv ers in th e Int ernet a nd a ll store s sa m e re du nda nt inform a tio n.
Authoritative
It h a s DNS database and it is of 2 types
1. Primary
2. Secondary
Primary
● It store s file fo r a z one for w h ic h it is resp onsib le.
● It is respo nsible for g enera ting m a inta ining a nd u pd a ting t his z one file .
Secondary
● It tra nsfe r th e co m p let e inform a tio n a bou t zone from a ny o the r se rve r(p rim a ry or sec onda ry) a nd sto re
th e file o n its d isk
● It neith er c rea te s nor u p da te the z one file.
● If u p da tio n is re qu ire d th e n it c a n be do ne only by prim a ry serv er a nd it se nt th e u pda te d file to all
sec onda ry serv ers.
● A lso note th a t w e ca n ha v e only o ne p rim a ry se rve r for z one a nd m a ny se conda ry serv ers for th e sa m e
z one.
● W h e n th e se co nda ry d ow nlo ad s inform a tio n fro m th e p rim a ry, it is c a lle d z one tra nsfe r a nd it is d one
by TC P.
WORKING OF DNS
● W h e n w e type U RL in a d dress ba r o f w eb brow ser like www.google.com it is pa rtia lly qu a lifie d d om a in
na m e (a s it doe s not end w ith a d ot).
● It pa sse s th is a d dress to p rogra m c a lle d resolver (D N S c lie nt) a nd it first conv ert it into FQ D N tha t is
www.google.com.
● N o w it w ill first c h ec k in D N S ca c he th a t is tem p ora ry m e m ory o r bu ffe r fo r th e m ap ping . If entry is
pre sent th e n co rresp onding IP a d dress is g ive n to w eb bro w ser. E ntry is pre sent if re ce ntly w e b
bro w ser h as ope ned th a t pa ge . T his entry is tim ed ou t a fter so m e tim e.
● If e ntry is a bsent th en th is resolve r w ill se nd th is qu e ry to loc a l D N S serv er (a ddre ss of th e serv er is
pre sent in T C P/IP setting s a nd is u pd ate d b y D H C P serv er w h en m /c is c onnec ted to internet)
● N ow th is se rve r w ill first ch ec k in its c a ch e if m ap ping is p rese nt th en it send s co rrespo nding a ddre ss to
resolve r a nd it send s to w eb bro w ser.
● Bu t if e ntry is not p rese nt th en it w ill se nd q ue ry to root server.
● Root serv er ha s IP a dd ress of all to p lev el dom a in se rve rs o nly so it d oes not h a v e IP a ddre ss of
w w w .go ogle.co m
● So it w ill send IP ad dre ss of serv er w h ose do m a in is .co m th a t is it partially solve the query.
● N ow loc a l D N S w ill se nd q ue ry to .com serv er a nd it w ill send IP a d dress of D N S se rve r of G oo gle
orga niz a tion bec a u se .co m serv er don't store IP a ddre sses of h osts of G o ogle orga nisa tion
● N ow a ga in loca l D N S se rve r se nd qu e ry to th is G o ogle D N S serv er w h ich ha s IP a dd ress of w w w , m a il,
plu s e tc ho sts of G oo gle a nd it w ill se nd IP a dd ress o f w w w .go ogle .com now it is fully solved.
● N ow qu e ry is resolve d a nd loc al D N S serv er se nd re ply to re solv er a nd th is resolve r re plie s to w eb
brow ser
DNS QUERY
W e h a ve 3 type s of D N S qu erie s
1. Reverse lookup query
● It is use d for rev erse pro cess i.e. IP to d om a in na m e
2. Recursive query
● W h e n client d o th is th en se rve r h a s to giv e definitive answer th a t is if na m e ex ists the n IP a ddre ss
oth e rw ise error m e ssag e m u st be giv en.
● D N S serv er c a n't re fe r c lie nt to a ny oth er D N S serve r
● G ene ra lly rec ursive qu e ries a re se nt by end dev ic es to lo ca l D N S serv er.
3. Iterative query
● D N S client a llow s t he D N S serv er to re turn best answer it m a y be definitive or not.
● S o no w D N S serv er c a n send IP o f ano th er D N S serv er a lso a nd client w ill req ue st th e sa m e q u ery t o it
● For ex am p le a s see n in w orking of D N S a ll 3 qu eries from loca l D N S se rve r a re ite rative qu e ries.
● T h is p roce ss is also c a lle d walking the tree.
REMOTE LOGGING
● In th e Inte rnet, u se rs m a y w a nt to ru n a pp lic a tion p rogra m s a t a rem o te site a nd cre a te re su lts th a t
ca n b e transferre d to th eir lo ca l site.
● For ex am p le, stu dents m a y w a nt to conne ct to th eir u niv ersity co m p u ter la b from th e ir h om e to
a cc ess a p plica tio n prog ra m s fo r do ing h o m e w ork a ssignm e nts or p rojec ts.
● O ne w a y to sa tisfy th a t de m a nd a nd o th ers is to crea te a c lie nt/se rve r a pp lic a tion p rogra m for ea ch
de sire d se rvic e.
● H o w ev er, it w ou ld be im po ssible to w rite a sp ec ific c lie nt/se rve r p rogra m for e a ch d em a nd.
● T h e b ette r solution is a general purpose client/server program th a t lets a u ser a c ce ss a ny a pp lic ation
pro gra m on a rem ot e c om pu te r; in oth er w ord s, a llo w th e u ser to lo g o n to a rem ote c om pu te r. A fte r
lo gging on, a use r c a n u se th e serv ic es a v a ila b le on th e rem ote c om pu ter a nd tra nsfe r th e resu lts
ba c k to the lo ca l com p u ter.
● P rotoc ol u sed for rem ote lo gin is T EL N ET .
TELNET
● T EL N ET is a n a bbre via tion for TErminaL NETwork
● It is th e sta nda rd T C P/IP prot oco l for v irtu a l term ina l serv ice a s p ropo sed by th e International
Organization for Standards (ISO).
● T EL N ET e nab le s th e e sta blish m e nt of a c onnec tion to a re m ote system in su ch a w a y th a t it a pp ea rs
to be a rem o te syste m th a t it th e loc al term inal of re m o te system .
Timesharing Environment
● T EL N ET w as designed a t a tim e w he n m ost ope ra ting sy stem s, su c h a s U N IX , w e re o perating in a
tim e sh aring e nviro nm ent.
● In su ch a n e nvironm ent, a la rge com p u ter su p ports m ultiple u se rs.
● T h e intera ction be tw e en a u se r a nd th e c om pu ter oc cu rs th rou g h a term inal, w h ic h is usu a lly a
co m bina tio n of keyb oa rd, m onitor, a nd m ou se .
● Ev en a m icro com p u ter c a n sim u la te a term inal w ith a term inal em u la to r.
Logging
● In a tim e sh aring e nviro nm ent, u se rs a re p a rt of th e system w ith so m e righ t to a cc ess re sou rce s.
● T o a c ce ss th e sy stem re sou rce s, th e u ser logs into th e syste m w ith a u ser id a nd pa ssw ord .
Types of logging
W e h a ve 2 type s of lo gging .
1. Local logging:
● W h e n a u ser log s into a loc a l tim esh a ring system , it is c a lle d loca l log -in.
● A s a use r typ es a t a term ina l or a t a w orksta tion ru nning a term ina l em u la to r, th e ke ystroke s a re
a cc ep ted by th e terminal driver.
● T h e te rm ina l d riv er p a sses th e ch a ra ct ers to th e ope ra ting syst em .
● T h e o pera ting syste m , in tu rn, interpre ts th e co m bina tio n of ch a ra cte rs a nd invo kes th e de sired
a pp lic ation p rogra m o r u tility. Figu re be low sh ow s th e logg ing p roce ss.
2. Remote logging
● W h e n a u ser w a nts to a cce ss a n a pp lic a tion p rogra m o r u tility loca te d o n a rem o te m a c h ine, sh e
pe rfo rm s rem o te log-in.
● H e re th e TELNET client and server p rogram s com e into u se.
● T h e u se r send s th e keystro kes to th e terminal driver, w h ere th e loc a l o pera ting syste m a cc epts th e
ch a ra c ters b u t does not interpret th em .
● T h e c h a rac ters a re se nt to th e TELNET client, w hich tra nsform s th e ch a ra cte rs to a u niv ersa l
ch a ra c ter se t
ca lled network virtual terminal (NVT) characters a nd de liv ers th em to th e loc al protocol stack.
● T h e c om m a nds o r tex t, in N V T fo rm , tra ve l th ro ug h th e Inte rnet a nd a rriv e a t th e T C P /IP sta ck a t th e
rem o te m a c h ine.
● H e re th e c h ara c ters are d elive red to th e op era ting system and pa sse d to th e TELNET server, w h ic h
changes th e ch a ra cte rs to th e c orre sponding c ha ra c ters und ersta nda ble b y th e rem ot e c om pu te r.
● H o w ev er, th e c h a rac ters cannot be passed dire ctly to t he op era ting syste m bec a u se th e re m o te
op era ting
syste m is not designed to receive ch a ra c ters from a TE LN E T serv er: It is designed to re ce iv e
ch a ra c ters from a term ina l driv er.
● T h e so lu tion is to a dd a pie ce of softw a re ca lled a pseudoterminal driver w h ich p rete nds th a t th e
ch a ra c ters a re co m ing from a term ina l.
● T h e o pera ting syste m th en p a sses th e ch a ra c ters to th e a ppro pria te a pplica tion pro gra m . B elo w
figu re ex pla ins th e c once pt.
Network Virtual Terminal
● T h e m e ch a nism to a cc ess a rem ote co m pu ter is c om plex .
● T h is is so b ec au se ev ery co m pu ter and its ope ra ting syst em a cc ep t a spe cia l c om bina tio n of
ch a ra c ters a s tokens. For ex a m ple , th e e nd-of-file toke n in a com p u ter ru nning th e D O S o pe rat ing
syste m is C trl+z , w h ile th e U N IX op era ting syste m rec ogniz es C trl+d .
● W e a re dea ling w ith h et erog eneo u s system s.
● If w e w a nt to a c ce ss a ny re m ote com p ut er in th e w orld , w e m u st first know w h a t typ e o f c om pu te r w e
w ill b e c onnec ted to, and w e m u st a lso insta ll th e sp ec ific te rm ina l e m u la tor u se d b y th a t c om pu te r.
● T EL N ET so lve s th is prob lem by d efining a unive rsa l inte rfa c e c a lle d th e network virtual terminal
(NVT) character set. V ia th is interfa ce, th e c lie nt T ELN ET tra nsla te s ch a ra c ters (da ta o r co m m a nd s)
th a t c om e from the lo ca l term ina l into N V T form a nd de liv ers th em to th e ne tw ork.
● A lso note th a t w e h a ve differe nt T ELN ET clients for diffe rent sy stem s w hich c h a ng es th e c om m a nd s
a nd d a ta into N V T ch a ra cte r set.
● T h e se rve r T EL N ET , o n th e oth er ha nd, tra nsla tes d a ta a nd c om m a nds from N VT form into th e fo rm
a cc ep tab le by t he re m ote com p ut er. B elo w figu re ex plains th e conc ept
● T EL N ET u se s only one TCP connection. T h e serv er u se s th e w ell-know n port 23, a nd t he c lie nt u ses
a n ephemeral port.
● T h e sa m e co nne ction is u sed for sending both data and control characters.
● T EL N ET a c com p lish es th is b y em b edd ing t he c ontrol ch a ra cte rs in the da ta strea m .
● H o w ev er, to d istingu ish da ta from c ontrol ch a ra cte rs, e ac h se qu ence o f c ontrol ch a ra cte rs is
pre ce ded by a spe cia l co nt rol c h a ra cter ca lled interpret as control (lAC).
Disadvantage of TELNET
It do es no t u ses any encryption technique a nd e ve n log in na m e a nd pa ssw o rd a re not e ncryp ted so for
sec u rity rea sons it is not used now a days.
ELECTRONIC MAIL
A t th e be ginning of th e Inte rnet e ra , th e m essa ge s sent by e lec tronic m a il w e re sh ort a nd c onsiste d o f te xt
only . To da y, e lec tronic m a il is m u c h m ore com p lex . It a llo w s a m e ssa ge to inclu d e te xt, au d io, a nd video . It
a lso a llo w s one m essa g e to be sent to o ne or m ore rec ipients.
Architecture
T o e xp la in th e a rch ite ctu re of e -m a il, w e giv e four scenarios. W e b egin w ith t he sim p lest situ a tion and a dd
co m ple xity a s w e proce ed. T h e fo u rth sce nario is th e m o st c om m on in th e e xc h ang e o f e m a il.
First Scenario
● In th e first sce na rio, th e sende r a nd the re ce ive r of th e e-m a il a re u se rs (o r a pp lic at ion p rogra m s) on
th e same system; th ey a re d irec tly conne cte d to a sh a red system .
● T h e a d m inistra tor ha s cre ate d o ne mailbox for e a ch u ser w h ere th e rec eiv ed m essa g es a re store d. A
is pa rt o f a local hard drive, a spe cia l file w ith p erm ission re strict ions.
● O nly the ow ner o f t he m a ilb ox h a s access t o it.
● W h e n A lic e, a u ser, ne eds to se nd a m e ssa ge to B ob , a noth er u ser, A lice ru ns a user agent (UA)
pro gra m to pre pa re the m e ssag e a nd UA itself w ill sto re it in B ob 's m a ilbox .
● T h e m e ssa ge h as th e se nder a nd re cip ient m a ilbo x a d dresse s (na m e s of file s).
● B ob ca n re triev e and read the contents of h is m a ilbox a t his co nve nienc e, using a user agent. Fig u re
be low sh ow s th e c once pt.
NOTE:
W h e n th e se nde r a nd th e rec eive r of a n e-m a il a re o n th e sam e syste m , w e nee d only tw o u ser ag ents.
Second Scenario
● In th e s ec o n d s c en a rio , th e s e n d er a n d th e rec eive r o f th e e -m a il a re u s ers (o r a p p lic a tio n
p ro g ra m s ) o n two different systems.
● S o th e m es s a g e n ee d s to b e s e n t o ve r th e In tern e t.
● H ere w e n e ed user agents (UAs) and message transferagents (MTAs), a s s h o w n in fig u re
b e lo w .
● A lice nee ds to u se a user agent p rogra m to send h er m e ssa ge to th e syste m at her own site.
● T h e c om pu te r (som etim e s c alled th e mail server) a t h e r site m a na ges a ll th e m essa g es re ce ive d and
m a kes a mail queue to sto re m e ssa ge s w a iting to be sent.
● M T A client kee ps on ch ec king th e q ue u e a nd w h en th ere is m e ssa ge the n it w ill try to e sta blish
co nnection w ith M T A serv er a nd w h e n co nne ction is esta blish ed th en it pick th e m essa ge s from
qu e u e a nd send the m ov er interne t to M TA serv er w h ich is ru nning at system from w h ich bob is
co nnecte d.
● M T A serve r a fte r rec eiving m essa g es w ill store th em a t m a il bo x of bob .
● Like m o st client/se rve r pro gra m s on the Interne t, th e serv er ne eds to ru n a ll th e tim e be ca u se it do es
not kno w w he n a c lie nt w ill a sk for a conne ctio n.
● B ob also ne eds a user agent prog ram to re trie ve m essa ge s stored in th e m ailbo x o f the syste m a t h is
site .
NOTE:
W h e n th e se nde r a nd th e rec eive r of a n e-m a il a re o n diffe rent system s, w e ne ed tw o U A s a nd a pa ir o f M T A s
(c lie nt a nd se rv er).
Third Scenario
● In th e third s c en a rio , B o b , a s in th e s ec o n d s c en a rio , is d irec tly c o n n ec te d to h is s ys te m .
● A lic e , h o w e ve r, is s ep a ra te d fro m h e r s ys tem .
● E ith er A lic e is c o n n ec te d to th e s ys tem v ia a p o in t-to -p o in t W A N , s u c h a s a d ia l-u p m o d em , a
D S L , o r a c a b le m o d em ; o r s h e is c o n n ec ted to a LA N in a n o rg a n iza tio n th a t u s es o n e m a il
s erv er fo r h a n d lin g e-m a ils -a ll u s ers n ee d to s en d th e ir m e s s a g e s to th is m a il s e rve r. F ig u re
b e lo w s h o w s th e s itu a tio n .
● A lice still nee ds a u se r a ge nt to prep a re h e r m essa g e. S h e th e n nee ds to send th e m e ssa ge th rou gh th e
LA N o r W A N . Th is ca n b e d one th rou gh a p a ir o f m e ssa ge tra nsfer a gents (client a nd serv er).
● W h e nev er A lice h a s a m e ssa ge to se nd, sh e ca lls th e use r a ge nt w h ic h , in tu m , ca lls th e M T A c lie nt. Th e
M T A client esta blish es a conne ctio n w ith th e M T A se rve r on th e syste m , w h ic h is ru nning a ll th e tim e.
● T h e m a il serv er co m p u ter a t A lic e's site m a na ges a ll m e ssa ges rec eiv ed a nd m a kes a m a il qu eu e . M T A
client kee ps on ch ec king this qu e u e a nd w h ene ve r th ere a re m essa ge s to send it e stab lish e s a
co nnection w ith M T A serv er a t B ob's site a nd se nds th e m essa g es. T h is se rve r re ceive s th e m essa ge s
a nd sto res it in Bob 's m ailbo x.
● A t h is co nv enience , B ob u ses h is u ser a g ent to retriev e th e m essa g e a nd rea ds it.
NOTE:
W h e n th e se nde r is c onnec ted to the m a il serv er via a LA N or a W A N , w e nee d tw o U A s and tw o pa irs of
M T A s (client a nd serv er).
Fourth Scenario
● In th e fou rth a nd most common scenario, B ob is a lso co nnecte d to h is m ail se rve r by a W A N or a LA N .
A fter th e m essa g e h a s a rrive d a t B ob 's m a il se rve r, Bo b ne eds to re trie ve it.
● W e c an’ t use s o f M T A c lie nt a t B ob com p u ter M T A se rve r a t m a il se rve r co m pu ter. T h is is be ca u se
M T A client is push program w h ic h pu sh es th e m e ssa ges to M T A se rve r, it ca n’ t p ull m e ssa ges from
M T A serve r.
● O th er option is u se M T A se ve r a t B ob co m p u ter w h ich is im p ossib le as now B ob ca n’ t shu t dow n
h er com p u ter b ec au se sh e doe sn’ t know w h en m e ssa ge w ill a rriv e.
● H e nce , w e nee d a noth e r set of client/serv er a gents, w h ich w e ca ll message access agents (M A A s).
● U nlike M T A c lie nt, M A A c lie nt is a pull program a nd it c a n pu ll m essa ge s from M A A serv er.
● S ee be low figu re
● S o B ob u ses an M A A client to re triev e h is m e ssag es. T h e client se nds a re qu est to th e M A A se rve r,
w h ic h is ru nning a ll th e tim e, a nd requ e sts th e tra nsfe r of th e m e ssa ge s. Figu re on nex t p a ge sho w s
th e situ a tion.
USER AGENT
T h e first c om po nent o f a n e le ctronic m a il syste m is th e u ser ag ent (U A ) It provide serv ice to th e u se r to m a ke
th e proc ess o f sending a nd re ce iv ing a m e ssa ge ea sie r. Be st know n ex a m ple is Microsoft outlook.
Addresses
T o d elive r m a il, a m a il h a ndling sy stem m u st u se a n a ddressing system w ith u niq u e a dd resse s. In the Interne t,
th e a ddre ss co nsists of tw o pa rts: a local part and a domain name, separated by an @ sign (se e Fig u re b elo w ).
MIME
● Elect ronic m a il h a s a sim ple stru c ture . Its sim plicity, h ow ev er, c om es a t a price . It ca n se nd m essa g es
only in 7-bit A S C II fo rm a t.
● In oth e r w ords, it h as som e limitations. For e xa m ple, it ca nnot be use d for languages th at a re no t
su pp orted by 7-bit A SC II c h arac ters (su ch as French , G erm a n, H e bre w , Ru ssia n, C hinese, a nd
J a pa nese ).
● A lso , it ca nnot b e u se d to send binary files or video or audio data.
● Multipurpose Internet Mail Extensions (MIME) is a su p ple m enta ry p rotoc ol th at allows non-ASCII
data to be se nt th rou gh e -m ail.
● M IM E tra nsfo rm s non-A S C II d a ta a t th e sende r site to A S C II d a ta a nd d elive rs th em to th e client M T A
to be sent th ro ug h th e Inte rnet. T h e m e ssa ge a t th e rece iv ing side is tra nsform ed ba c k to th e o rigina l
da ta .
● W e c an think of M IM E a s a se t o f so ftw a re func tions tha t transforms non-ASCII data (stream of bits)
to ASCII data and vice versa, a s sh ow n in Fig u re b elo w
● M IM E a llow s se ve n differe nt type s of da ta like a ud io, vid eo , im a ge etc .
SMTP COMMANDS
HELO. Th is co m m a nd is u se d b y th e client to ide ntify itse lf.
MAIL FROM. Th is co m m a nd is u se d b y th e client to ide ntify th e sende r of th e
m essa g e.
RCPT TO. T h is com m a nd is u sed by th e c lie nt to ide ntify th e intende d re cip ient of
th e m essa ge .
DATA. T his co m m and is u se d to send th e ac tu a l m e ssa ge.
QUIT. T his co m m a nd term inat es th e m essa ge .
RSET. T his co m m and a borts th e c u rrent m a il tra nsa ction.
VRFY. T h is c om m a nd is u sed to ve rify th e a d dress of th e re cipie nt .
NOOP. T h is com m a nd is u sed by th e c lie nt to ch ec k th e sta tu s of th e rec ipie nt
TURN. T h is c om m a nd lets th e send er a nd th e re cipie nt sw itc h po sitio ns, w h ere by
th e sende r be co m e s th e rec ipient a nd vic e ve rsa
EXPN. T h is c om m a nd ca n ve rify th e e xistence of o ne or m ore m a ilbo xe s on the syste m .
HELP. T h is c om m a nd a sks th e re cip ient to se nd inform a tio n a bou t th e co m m a nd
sent a s th e a rg u m e nt.
SEND FROM. T h is c om m a nd sp ecifies th a t th e m a il is to be de liv ere d to th e
term inal of th e rec ipient, a nd no t th e m ailbo x.
SMOL FROM. T h is c om m a nd sp ecifie s th a t th e m a il is to be de liv ere d to th e term ina l
or th e m a ilbox of th e rec ipient.
SMAL FROM. T h is c om m a nd sp ecifie s th a t th e m a il is to be de liv ere d to th e term ina l
a nd th e m a ilb ox of th e recipie nt.
● O n th e oth er h a nd , th e th ird sta g e ne eds a pull protocol; th e client m ust pu ll m essa ge s from th e serv er.
T h e d irec tio n of th e b u lk da ta is from th e serv er to th e client. The third stage uses a message access
agent.
● C u rrently tw o m essa g e a c cess proto co ls a re a va ila ble : P ost O ffice Pro toc ol, v ersion 3 (P O P 3) and
Internet M a il A c ce ss P rotoc ol, ve rsion 4 (IM A P 4). Figu re be low sh ow s the p ositio n of th ese tw o
pro toco ls in th e m o st co m m on situ a tio n (fou rth sc ena rio ).
POP3
● P ost O ffic e Pro toco l, v ersion 3 (P O P3 ) is sim p le and lim ited in fu nc tio na lity. T h e c lie nt P O P3 softw a re
is insta lle d o n th e re cipie nt co m p u ter; th e serv er P O P 3 softw a re is insta lle d on th e m a il serv er.
● M a il a cce ss sta rts w ith th e client w h en th e u ser ne ed s to d ow nloa d e -m a il from th e m a ilb ox on th e
m a il serv er.
● T h e c lie nt op ens a c onnec tion to th e serv er on TCP port 110.
● It th en sends its user name and password to a cc ess th e m a ilb ox. T h e u ser c a n th en list a nd retriev e
th e m ail m e ssa ges, one b y one . Figu re be low sh ow s an ex a m p le of dow nloa ding u sing PO P 3.
● P O P3 h a s two modes: the delete mode and the keep mode.
● In th e delete m ode , th e m ail is deleted from the mailbox a fter e a ch retrieval. In th e ke ep m ode , th e
m a il remains in the mailbox a fte r retriev a l.
● T h e d ele te m ode is no rm ally u se d w h en th e u ser is w o rking a t he r p erm a nent c om pu te r a nd c a n sa ve
a nd o rga niz e th e rec eive d m a il a fte r re ad ing o r re plying .
● T h e ke ep m ode is norm a lly u sed w h en th e u ser a cce sses he r m a il a w a y from h e r prim ary co m pu ter
(e .g., a la p top). Th e m a il is re a d b ut kep t in th e syste m fo r la ter retriev a l a nd o rga niz ing.
IMAP4
IM A P4 u ses TCP port number 143 a nd prov ide s th e fo llo w ing ex tra fu nct ions w hich a re not p rov ide d b y
P O P3
● A u se r ca n c h ec k th e e-mail header prior to do w nloa ding.
● A u se r ca n search the contents of th e e-m a il for a spec ific string of ch a ra cte rs prior to do w nloa ding.
● A u se r ca n partially download e-mail. T h is is esp ecia lly use fu l if ba ndw idth is lim ited a nd th e e-m a il
co nta ins m u ltim e dia w ith h ig h ba ndw idth re qu ire m ents.
● A u se r ca n create, delete, or rename m a ilb ox es o n th e m a il se rve r.
● A u se r ca n c rea te a hierarchy of mailboxes in a fo lde r fo r e-m a il stora ge .
Data Structure
● FT P ca n tra nsfe r a file a cro ss th e da ta co nnection b y u sing one of th e follow ing inte rpreta tions a bo u t
th e stru ctu re of th e d a ta : file structure, record structure, and page structure.
● In th e file structure fo rm at, th e file is a continuous stream of bytes.
● In th e record structure, th e file is divided into records. Th is ca n b e used only with text files.
● In th e page structure, th e file is divided into pages, w ith ea c h pa ge h a v ing a p a ge num b er a nd a pa ge
h ea d er.
● T h e p a ges ca n be stored and a cc esse d ra ndo m ly o r seq ue ntia lly.
Transmission Mode
● FT P ca n tra nsfe r a file a cro ss th e da ta co nnection b y u sing one of th e follow ing th ree tra nsm issio n
m od es: stream mode, block mode, and compressed mode.
● T h e stream mode is the default mode. D a ta a re de liv ere d from FT P to T C P a s a continuous stream of
bytes. TC P is resp onsib le for c hopping data into segments of a pp ropriate siz e. If th e da ta a re sim ply
a stre a m of byte s (file stru c tu re), no end-of-file is needed. E nd-of-file in th is ca se is t he c losing of th e
da ta c onnec tion by th e send er. B u t if th e da ta a re div ide d into re cords (rec ord st ruc tu re), ea c h rec ord
w ill h a v e a 1-byte end of rec ord (E OR ) c h a ra cter a nd th e end of th e file w ill ha v e a 1-byte end -o f-file
(E O F) c h a ra cter.
● In blo ck m o de , da ta c an be deliv ered from FT P to T C P in blocks. In this ca se , ea c h block is pre ce de d
by a 3-byte header. T he first b yte is c alled th e block descriptor th e next 2 bytes de fine th e size of the
block in byte s.
● In th e compressed mode, if the file is b ig, th e d at a ca n be c om pre ssed. T h e co m p ression m eth o d
norm a lly u sed is run-length encoding. In th is m e th od, c onse cu tiv e a p pea ra nc es o f a d a ta u nit a re
rep la ce d b y one oc cu rre nce a nd th e num b er o f repe titio ns. In a tex t file , th is is u su ally sp a ces (b la nks).
In a binary file, nu ll c ha ra c ters are u su a lly co m p resse d.
ANONYMOUS FTP
● T o u se FT P, a u ser ne eds a n a cco u nt (u se r na m e) a nd a p a ssw ord on th e rem o te se rve r.
● S om e sites h a ve a set of files av a ila b le for pu blic ac ce ss, to ena ble a nonym ou s FTP .
● T o a c ce ss th ese files, a u ser d oe s not ne ed to h a v e a n a c cou nt or p assw ord. Instea d , th e use r c an u se
anonymous as the user name and guest as the password.
● U se r a cc ess to th e system is very limited. S om e site s a llow a no ny m o u s u sers only a sub set of
co m m and s. For e xa m ple, m o st site s a llo w th e u ser t o c opy som e files, b ut do not a llow na v iga tion
th rou gh th e d irec torie s.
FTP COMMANDS