• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to maintain a session in Client/Server Environment in java  RSS feed

 
Jyotisree Dhar
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
I faced one question in interview .The question is ,How to maintain a session in Client/Server Environment in java.It means no webserver,simple client/server application.
Please tell me , if any body know this thing.
Regards
Jyotisree
 
Siva Jagadeesan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The session Management should be easily done in a web server ( because of the Servlet API). But if you have to session Management in client/Server environment, where the Java Class is listening in a particular port rather then a web server and a client is a swing client, then things get little messy. One way , we can do session management in this kind of client/server environment is, when a client connects to the server , the server could give a unique ID to the client and the client could pass the ID whenever it is taking to the Server. It is like you are taking care of the Session Management in your program.
I hope this helps. If anyone knows a better way, let me know
 
Jyotisree Dhar
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Siva, I am agreed with your reply. In more refined way, one thread can be started at server end to keep track of interval set. For each event on Client, time for the thread would be reset for that perticular Client Id.
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jyotisree,
Thanks for joining JavaRanch.
Unfortunately your name violates our naming policy. Please take a quick look at the rules and edit your profile accordingly.
Thank you!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!