Hi All,
I am trying to design a very basic chat room in
Java RMI. My design brief is that all clients messages should be displayed to other clients and also captured and displayed on the server. I have been able to get as far as getting all client messages to display on the server side, but I am having difficulty in being able to display the messages sent by clients to other clients. I have constructed a GUI for clients in netbeans for them to type and receive text. Does anyone know of any ways I can go about solving this issue?
Initially I thought that I could register all the clients into an array and then loop through that array when a message is received on the server from a client and send the message to all other clients. Im not sure what unique identifier i could use in this instance, the only thing that came to mind would be to capture the clients ip address and store this in an array and then create an interface class for the client program and then create a method that can be called form the server by looping through the IP addresses but surely this would require starting the rmiregistry service on the clients which is totally defeats the purpose of the application.
I have attached the code that I have so far for everything. I know my naming conventions are quite poor, so ill try and clarify as i post it. Any help will be greatly appreciated.
The Server Interface
The Server Side Code
Client GUI and Client Running Code