Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can any one tell me how to make clients to communicate with each other directly?

 
Farhad Rahmati
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either JavaSpaces or Java Message Service would work but note that communication would have to be indirect through a server.

Bill
 
Farhad Rahmati
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many Thanks for this information Bill

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
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Bill

it was helpful


Cheers
Farhad
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic