Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

RMI chat program

843793Nov 16 2006 — edited Nov 21 2006
Hi!

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;
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 19 2006
Added on Nov 16 2006
16 comments
464 views