This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Applets and the fly likes Chat Applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Chat Applets" Watch "Chat Applets" New topic
Author

Chat Applets

Jemal Mohammed
Greenhorn

Joined: Jul 05, 2007
Posts: 9
hello
I am developing a chat application using applet and servlet. I have got a problem in knowing the total number of users online and their names.

thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
Don't the users need to log in (maybe using a password) before they can start chatting? That would provide you with the name sof all users online. You could drop someone from the list once they haven't posted in N minutes. Or the client applet could ping the server every so often, and if stops doing do, it must have been closed, so the user is definitely offline.


Ping & DNS - my free Android networking tools app
Jemal Mohammed
Greenhorn

Joined: Jul 05, 2007
Posts: 9
that is okay. but is there any information stored on a cookie or servlet session showing weither a browser is closed or not?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
Cookies and session store whatever you put in there. Nothing is put there automatically for you.

If you want to make a guess when the applet or browser has been closed, then you can do what I suggested (i.e., the client needs to ping the server in regular intervals).
Baseet Ahmed
Ranch Hand

Joined: Dec 18, 2006
Posts: 224
Jamel Mohammad,
Is your problem solved?






***********************************
Tip: Sincerity is mother of all acheivements.
***********************************
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Chat Applets