I am trying to develop a chat application. I used AsyncSocket and followed tutorial. So now I can receive a text msg from telnet using localhost.
But I don't know how to handle multiple chats. Lets say three different friends know my IP address and port number. They send a message to me over the socket. Then how am I going to figure out which message belongs to which friends?
Thanks in advance.
Either use a different connection/socket for each friend, or create a protocol for sending/receiving data in your chat that encapsulates not only the actual message body, but the sender's name, timestamp, etc.