Can any one tell me how to make clients to communicate with each other directly?
Farhad Rahmati
Ranch Hand
Joined: Dec 16, 2010
Posts: 96
posted
0
hi
I have Three classes which could be run in different machines,
Orders which could be run as a server
Cashiers and cooks which are clients
Cashiers add orders and clients remove order. I used sockets and it's okay and working but the problem is if a cook remves an order from a queu. I want him to directly report to cashier who added the order.
can any one give me a clue how to do this
Thanks
Farhad
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
1
posted
0
Either JavaSpaces or Java Message Service would work but note that communication would have to be indirect through a server.
I have sockets and others staff which broadcost to every one when the order is added or removed
I mean when you add order every one gets a message or when you remove an order ever one knows that.
but for this feature which just a message for cashier who adds the order when you remove an order
do I need any special socket like multicast or any othr staff?
one things else which one do you think is easy and okay to use
thanks
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
1
posted
0
Easiest to use = the toolkit designed to handle this problem.
You don't have to "roll your own" multiple client server communication system from raw sockets unless this is a class assignment.
Personally I would use JMS - or JavaSpaces.
But you will learn more if you roll your own so lets back off a bit and think about the architecture. You presently want:
I have sockets and others staff which broadcost to every one when the order is added or removed
I mean when you add order every one gets a message or when you remove an order ever one knows that.
but that is unnecessarily complicated. The only entity that needs to know what everybody is doing is the central server, the cashiers and cooks only do one thing at a time. The cook can put an "order up" on the server and the server can notify the cashier. Only the server needs to know which cashier gets which order.
Bill
Farhad Rahmati
Ranch Hand
Joined: Dec 16, 2010
Posts: 96
posted
0
Thank you very much Bill
it was helpful
Cheers
Farhad
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Can any one tell me how to make clients to communicate with each other directly?