View Single Post
  #7 (permalink)  
Old 10-07-2008, 10:55 PM
mrhyman mrhyman is offline
Member
 
Join Date: Oct 2008
Posts: 8
mrhyman is on a distinguished road
Hi Norm,

Sure I can do that:

I have a client server program I have

On the server there is the

Balance Variable

The Buyitem(Item,Quantity) method
the Sellitem(item,Quantity) method

The client can invoke

Buyitem which looks like this:

public buyitem(item,quantity){

if (balance > quantity * item){
//Ask seller's server to sell
sellitem(item,quantity)
balance = balance - quantity * seller.Getprice();

}

the sellitem method looks like

public sellitem(item,quantity){

balance = balance + Quantity * price

}

I need to make sure that the variable balance, quantity, etc on the server are synchronized with the correct calls.

There can be multiple servers: each managing their own balance and quantity

there exists the same number of clients as servers and the clients calls only the buyitem method which is directed towards the correct server who will sell his item.

therefore if I have 3 client/servers, 2 clients can invoke the buy method on the 3rd server.

I hope this makes it a bit clearer.
Reply With Quote