• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

my statrgy of clientid's creation

 
Gerald Kou
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I make a ID class which has a static couter.when clients request to the server,server get a ID's
couter which is added every once.So all the client can get a unique id.But My question is that if server crashed,then couter is set to zero. I think that some alive client had old clientids which are same to the new id made from the server.
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My question is that if server crashed, then couter is set to zero. I think that some alive client had old clientids which are same to the new id made from the server.
There are different ways to deal with this problem. However, I would say you don't need to worry about server crashes, dead/alive clients, and reconnection issues, -- it's outside of the scope of this assignment. Instead, if it is the FBN assignment, think about how you would track the clients better. While your approach will work, you would need to pass the client id to the lock/unlock methods, thereby modifying the signatures of these two methods specified in your requirements.
I passed my assignment some time ago, so I am maybe a bit out of synch with the current requirements, so take this as a research item, not as an absolute.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic