2 posts
Posted 06 December 2013 - 08:54 PM
Ok so I am planning on making a POS system(Point of Sale aka a cash register) and I want it to have logins and passwords per employee. So far, I have thought of using a server computer with the logins and passwords each in their own file, and then have the register communicate with the server for authentication, but if there would be two people logging on simultaneously, how can I keep it so that the computer keeps both of the messages separate? Kind of like having two bank accounts being accessed at once. If one person "swipes" their card, and the PIN screen comes up, and another person at another register "swipes" their card, how could I make it so that the server computer keeps both PINs and both "transactions" separate?
8543 posts
Posted 06 December 2013 - 09:39 PM
Have the server check the sending computer's ID when it receives the message via rednet. I'd use the rednet API for something like this for that exact reason.
7083 posts
Location
Tasmania (AU)
Posted 07 December 2013 - 08:32 AM
There are a number of ways to have the server handle multiple conversations. Probably the easiest is to maintain a table which is used to keep track of what screen each client should be looking at - run a loop that waits for incoming data and sends back a response based on what was received vs what's in the table record for that client.
For example, when a computer logs in, you store a record in the table indicating that's happened. If a computer tries to request a bank balance for a given account but there's no record in the table saying that computer's signed in to that account, then the server sends back an error.
Relying on computer IDs to track sessions is not very secure at all, but an easy start. Depending on how you feel about it once you've got a basic implementation going you can always upgrade it to make use of encryption later. Security generally boils down to "making things more trouble then it's worth to break into", so if no one on your server has any programming knowledge or desire to interfere with your system, then you don't have to try very hard.
It's difficult to guess how much of this makes sense to you without knowing your current level of expertise re programming or ComputerCraft. Are you familiar with CC network transmissions? Tables? Loops? If you've already written any code for this project, it'd be worth posting as an example.