This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Distributed Java and the fly likes Can any one tell me how to make clients to communicate with each other directly? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Can any one tell me how to make clients to communicate with each other directly?" Watch "Can any one tell me how to make clients to communicate with each other directly?" New topic
Author

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
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: 12761
    
    5
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

Joined: Dec 16, 2010
Posts: 96
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

Joined: Mar 22, 2000
Posts: 12761
    
    5
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
Thank you very much Bill

it was helpful


Cheers
Farhad
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Can any one tell me how to make clients to communicate with each other directly?
 
Similar Threads
Need opionions: GUI table design
A Problem with with Java network programming
xml and jsp
How to block access based on elements existance?
j2me: Unable to import java.math.*;