Reputation: 118
I am trying to make a very simple chat program using RMI (no GUI's) but i am struggling for ideas. How do i register clients when they connect to the server? When i use
RemoteServer.getClientHost()
all this does is show the ip address (and they are the same for all clients that connect from the same computer (from multiple command windows). What i am trying to implement is this: when a client logs on he is shown a switch-case menu and ift they press
they get a list of connected clients.
sendMessage(client, String)
But i do not know how to identify individual clients?
And when i do, how do i show a string only on that client's window ?
Thanks,
Research: (i have looked at ideas on the web but a lot of them are more advanced than i want. This is a simple application and i do not want to complicate it / copy code i dont understand). There are previous questions on SO but with 0/1 answers (not very popular topic!) or not helpful!
Upvotes: 2
Views: 2264
Reputation: 118
Looks like i found what i was looking for:
RMI Callback
Basically making every client a server, so the server can respond as well as receive messages.
I have been directed to a resource that might help:
Java Network Programming and Distributed Computing by David Reilly & Michael Reilly
Upvotes: 1