File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes looking for code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "looking for code" Watch "looking for code" New topic

looking for code

Jardel Tan

Joined: Sep 11, 2001
Posts: 14
anyone did any code that can show how many users that are currently connected to ur websites?
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
If your web app was session-enabled, and your sessions were not non-expiring, I suppose you could create a HttpSessionListener to keep track of the total number of valid sessions at any given time.
Dave Soto
Ranch Hand

Joined: Sep 15, 2001
Posts: 55
Right... HTTP does NOT establish persistent connections, so the question "How many users are currently connected?" can have more than a couple interpretations...
I agree. Here's the link:
subject: looking for code
It's not a secret anymore!