• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session implementation

 
Pradip Bhattacharya
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure whether this is the right place to post this question or not.

I need to make a client-server application where the client will log in for some service. Whenever the client logs in the server will provide a unique number to the client, this number will help the server to identify a client. I was wondering what would be the best way to generate this unique number. Should I use IP address of the client to generate this number or not. Please do let me know about your ideas/suggestion and if possible any good literature that I can refer to.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Programming Diversions is for fun questions/quizes.

Will move your question to JIG Beg. where they can talk about GUIDS with you.

Eric
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know. But you can have several people from the same IP and the same person can have several IPs, so I don't think IPs will work.
 
Pradip Bhattacharya
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can same person have multiple IPs ?
 
K. Tsang
Bartender
Pie
Posts: 3222
12
Android Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well depends on how you look at it. A computer indeed only has one IP address. But from the application viewpoint, if say you allow 2 different users to log in at the same time on the same computer ... voila IP generated session ID will crash.

A better approach may be to use the hashcode of the username and password.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right about two people with the same IP, K Tsang. Thank you. We also have people here on JavaRanch whose IP changes from time to time; presumably they log in on different computers.
A hash, however, risks collisions; it is only a matter of time before two people have the same hash.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic