-
Chat Room help
Hi,
I have made a chat room using with RMI in netbeans, I need to make multiple rooms however and was not sure how to do it. Would i be right to assume that you have to create a port on the server that runs the second room for you or is there a different way to do it?
Cheers,
Noel
-
I've never done this with RMI, but I have done this using simple sockets and object serialization.
In my implementation, I kept all the 'rooms' on the server, and each client would communicated with the server and identify itself in each message. In this way, the server knew where to direct messages. That way, the server only needs to use the one port, and each client has its own socket.
I would imagine that in using RMI, you could pass information about who is talking to whom as parameters ... But I don't know how an RMI implementation would keep track of its clients.
In my app, it was IRC style and every message sent to the server was relayed to every client in the current room - so the server kept a list of sockets for each room. A single thread and server socket listened to messages from all clients and directed them from there.
-
what mirc does is
User room:message
it redericts it to the users listening to that room
pretty simple:)