This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes What is the best way for checking for unique users. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "What is the best way for checking for unique users." Watch "What is the best way for checking for unique users." New topic
Author

What is the best way for checking for unique users.

Ankit Chaudhari
Greenhorn

Joined: Jun 11, 2013
Posts: 3
Hello,

I have a web application which has a login feature.

At the same time, it has few features available to everyone (one who does not login to application)

What is the best way to search for unique users?

(First thought: I was planning to get ip address of each hit and save it in the db. Just doesn't feel right. )

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11164
    
  16

What if two people share a computer - or log in from a public one at a library or community center?

I guess the question (in my mind) comes back to "how do you define a unique user?"


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Ankit Chaudhari
Greenhorn

Joined: Jun 11, 2013
Posts: 3
Yes, you have a valid point.

For me user is a computer so I can settle for a unique user to be identified by an unique IP address.

Ankit Chaudhari
Greenhorn

Joined: Jun 11, 2013
Posts: 3
Putting the architecture's cap on, Is it a good approach to declare a new IP address as an unique user?

Has anyone worked on this kind of situation before?
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7552
    
  18

Ankit Chaudhari wrote:Putting the architecture's cap on, Is it a good approach to declare a new IP address as an unique user?

I'd say no, for all the reasons already given. An IP address is just that: an address; you're trying to force it to "be" something different - a user - and that rarely works in the long run. You may also run into situations where the IP address either
(a) isn't visible, or
(b) changes from login to login (for example, if it's allocated by a DHCP server).

Java is an object-oriented language, so why not create a User class tailored to the needs of your app? How and where you store it are up to you; but it's a secondary consideration compared to what it means for your system.

As far as "catchall" users are concerned, Unix has a guest user that is often used as a default. You might want to try something similar.

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 867
    
    5
> You may also run into situations where the IP address

... happens to be the IP address of a corporate firewall.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the best way for checking for unique users.
 
Similar Threads
best way to keep tracking of the user info?
Best way to model an 'exam' web-app
dont understand implementation sessions
best way to implement session handling