Files
Thomas Quinot 2803831374 Update configure to reflect change in GNATDIST sources.
Subversion-branch: /trunk/GLADE
Subversion-revision: 126878
2008-07-18 12:51:57 +00:00
..
1997-04-10 13:15:41 +00:00
1997-04-10 13:15:41 +00:00
1997-03-13 16:06:35 +00:00
1997-03-13 16:06:35 +00:00
1997-03-13 16:06:35 +00:00
1997-03-13 16:06:35 +00:00
1997-03-13 16:06:35 +00:00
1998-02-11 22:11:17 +00:00
1997-03-13 16:06:35 +00:00

This example describes a way to develop client / server
applications.

There are three main ada units in this bank example. The "bank" that
manages the client accounts, a "manager" which loads the accounts from
a small database and provides some utilities and clients which modify
their accounts and transfer money from their account to the account of
someone else. This is always the same executable for the different
clients, but of course, they don't get the same partition id in order
to differentiate them.

--

To play with this example, you can do the following :

% gnatdist simcity

Open (at least) 3 sessions.

[On session 1, starts the scenario, load "example" database and print
the account status]

% bank_server

Menu :

   Create
   Load
   Print
   Quit
   Save

Request : l

=> Load
Filename : example

Menu :

   Create
   Load
   Print
   Quit
   Save

Request : p

=> Print

   Customer : poor
   Password : xxxx
   Customer :  25

   Customer : middle
   Password : yyyy
   Customer :  250

   Customer : rich
   Password : zzzz
   Customer :  2500


Menu :

   Create
   Load
   Print
   Quit
   Save

[On session 2, start the poor client]

% bank_client
Customer : poor
Password : xxxx

Balance : 25

Menu :

   Balance
   Deposit
   Withdraw

Request : d

=> Deposit

   Amount : 1000

Balance : 1025

Menu :

[On session 3, start the rich client and transfer money from rich to poor]

% bank_client
Customer : rich
Password : zzzz

Balance : 2500

Menu :

   Balance
   Deposit
   Withdraw

Request : w

=> Withdraw

   Amount : 1000

Balance : 1500

Menu :

   Balance
   Deposit
   Withdraw

[On session 1, ask for the balances]

Request : p

=> Print

   Customer : poor
   Password : xxxx
   Customer :  1025

   Customer : middle
   Password : yyyy
   Customer :  250

   Customer : rich
   Password : zzzz
   Customer :  1500