How to program private chatting
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   vishal_puri
Posted On:   Thursday, June 21, 2001 10:41 PM

I made a chat application using socket programming, it's just a common chat program where chat server
receives socket from client and echo it to all connected clients  

I could not implement private chat feature



Can u suggest me write this piece of code and implement in my existing program?

Re: How to program private chatting

Posted By:   Mohammed_Burhanuddin  
Posted On:   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.
About | Sitemap | Contact