RMI chat program
843793Nov 16 2006 — edited Nov 21 2006Hi!
i am trying to create a chat program with lots of clients. i need to be able to send a message from a client to all clinets.
So far im calling the send message method on the server reistry,
which calls the recieve method on the chatters registry. But!
its only sending the message back to the client sending the message and doesnt send the message to all registrys
therefore i need to know how do make the server send to all clients?
//the servers RMI method
public String chat(String userName, String message)
{
String msg = null;
try
{
// must call this for every user on the system???
Chatter chatter = new ChatterImp();
msg = chatter.receiveChat(userName, message);
}
catch (Exception e)
{
e.printStackTrace();
}
return msg;
}
//the clients RMI method
public String receiveChat(String name, String message)
{
return name.toUpperCase()+" Says = "+message;
}