Re: How to program private chatting
Friday, June 22, 2001 05:13 AM
I hope you are maintaining all the sockets in some collection class at server end. For privatechat, now for simplicity use a hashtable where in you try to capture the id of the client, and dump in the hashtable the captured socket object and id as key.
Now you have to comeout with some protocol where in you should be able to differentiate and identify who wants to write to whome. And once you know the id of client whome you want to send, just get the socket object form the hashtable using the id and simply write to that corresponding socket.
Simple, isn't it.