Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet - Servlet Communication

 
sekhar k
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everybody,
I am doing chat application using Applet - Servlet Commnication. upto public messaging i did not find any problem but come to private chating i did not get any idea for open a personal chat window for one perticular client." For my public messaging my applet will communicate every time with server and get new messages as well as userlist". plz give solution for my query
------------------
 
daman sidhu
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Buddy
I have made a chat application involving public , private chatting and rooms and also a server console to kick people out etc. using applets and sockets and an application on server side instead of servlets, but the logic ull have to use is the same-
see ull have to use URL and URLConnection class in that and maybe u are using that, for private message what u can do is keep a hashtable on the server keeping the name of client as a string and an object of a class containing input and outputstreams of a particular client(ull have to instantiate this in the loop where ur listening for clients and then pass the streams us get into the constr of that class) , now if u want to send a mssg to one user , select that client from list, and send mssg to server starting with an identification string say "*Pm" and the name of that user and the meesage, now at server identify the srting coming begining with "*pm" get the user name and message string from that and from the corresponding object of connection class with that name ( which we stored as key value in hashtable) and send the message to him via that , try this out, it will work,if u still have problems tell me , hope this helps u
Regards,
Daman
 
daman sidhu
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Buddy
I have made a chat application involving public , private chatting and rooms and also a server console to kick people out etc. using applets and sockets and an application on server side instead of servlets, but the logic ull have to use is the same-
see ull have to use URL and URLConnection class in that and maybe u are using that, for private message what u can do is keep a hashtable on the server keeping the name of client as a string and an object of a class containing input and outputstreams of a particular client(ull have to instantiate this in the loop where ur listening for clients and then pass the streams us get into the constr of that class) , now if u want to send a mssg to one user , select that client from list, and send mssg to server starting with an identification string say "*Pm" and the name of that user and the meesage, now at server identify the srting coming begining with "*pm" get the user name and message string from that and from the corresponding object of connection class with that name ( which we stored as key value in hashtable) and send the message to him via that , try this out, it will work,if u still have problems tell me , hope this helps u
Regards,
Daman
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic