quote:Original post by TreizeSG
RMI isn''t a two-way street is it? Clients can make a connection to the server, but the server can''t talk to other clients, can it?
You are correct that RMI is not a two-way street, sort of. What you are missing is that methods can have a return type. So what you can do is set up a thread to poll the server every second or whatever and get a String back from the server with the latest chat messages. Something like:
class MyThread extends Thread {...public void run() { while(!done) { String message= chatClassRMIInstance.update("username"); if(message!=null) { //update client area } try { Thread.sleep(1000); } catch(InterruptedException e) { e.printStackTrace(); } }}...}
First make it work,
then make it fast.
--Brian Kernighan
"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book