The Client Server Model Part2 - M Liu
The Client Server Model Part2 - M Liu
M. L. Liu
m e s s ag e
e ch o
m e s s ag e
e ch o
m e s s ag e
e ch o
m e s s ag e
e ch o
c o n c u r r en t s er v er
p r o c es s
th e s er v er c o n n ec tio n q u eu e
s erv ic e
a c h ild th read p r o c es s es
th e p ro to c o l f o r a A c lien t p ro c es s w h o s e c o n n ec tio n h as b een ac c ep ted
c lien t p ro c es s
A c lien t p r o c es s w h o s e c o n n ec tio n h as b een ac c ep ted
E c h o Se r v e r 3
t h read 2
ac c ep t
c o n n ec tio n
FTP C l i e n t
FTP C l i e n t
f ile p o sit io n
G E T f ile n a m e
G E T f ile n a m e
f ile I D
read y
s e n d < f ile I D > , b lo c k 0
s e n d n ex t b lo c k
d a ta f r o m b lo c k 0 o f f ile
d a ta f r o m b lo c k 0 o f f ile
s e n d < f ile I D > , b lo c k 1
s e n d n e x t b lo c k
d a ta f r o m b lo c k 1 o f f ile
d ata f r o m b lo c k 1 o f f ile
... ...
Distributed Computing, M. Liu 18
Stateful vs. Stateless server
Stateless server is straightforward to code.
Stateful server is harder to code, but the state information
maintained by the server can reduce the data exchanged,
and allows enhancements to a basic service.
Maintaining stateful information is difficult in the presence
FTP s e r ve r
G E T f ile n a m e
r ead y
s en d n ex t b lo c k
d ata f r o m b lo c k 0 o f f ile
d ata is lo s t d u e to n etw o r k f a ilu r e
s en d n ex t b lo c k
c lien t r es u b m its r eq u es t
d ata f r o m b lo c k 1 o f f ile
c lien t r ec eiv es d ata as b lo c k 0 o f f ile;
... th e tr u e b lo c k 0 is m is s ed .
C lien t