You'll need to come up with implementing a protocol; check out XMPP Part of the issue is determining which other user you will be sending the message to. XMPP helps to solve that issue. I would suggest that each user that connects to the server would have a thread to handle the connection.
Then you can store all of the threads into a HashMap where the key would be the username. Then just push messages onto the thread implementation which would send the message(s) to the client.
You'll need to come up with implementing a protocol; check out XMPP. Part of the issue is determining which other user you will be sending the message to. XMPP helps to solve that issue.
I would suggest that each user that connects to the server would have a thread to handle the connection. Then you can store all of the threads into a HashMap where the key would be the username. Then just push messages onto the thread implementation which would send the message(s) to the client.
– Delanoy Mar 27 at 23:30 They don't talk to each other directly, they talk to the server and the server keeps track of where messages need to be routed to. So user A sends a message to the server that says "Send this to user B" then the server sees that user B is connected and sends the message saying "User A says ". – jmichalicek Mar 27 at 23:50 @Delanoy: Client A would send an XMPP message to the server; the server would look through it's connected client HashMap (or ArrayList or LinkedList or some container type if you wanted to box one of these) to find Client B.
The server, if successful, would push the new message onto a queue in Client B and send a receipt back to client A. If not successful the server can send a failure to Client A. NOTE: When I say the server looks for Client B it is looking for the thread in the server where Client B is connected.
– Suroot Mar 28 at 2:01.
For a basic chat system you will want the following features: A client logs into your server. This allows you to identify the client and to keep friend lists for each client. A client only ever sends messages to the server.
A client only ever receives messages from the server. Each message must identify the following: The recipient of the message. The source of the message.
The text of the message. Maybe; time and date the message was sent. The server will need to track conversations; basically a list of client pairs.
If you want to do group chats, then the conversion will be a list of client lists. When a client sends a message to the server, the server should forward it to all other clients that are part of the conversation. You probably want to have the server log all conversations.
You will need at least 2 message types; text (i.e. Chat) and invite.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.