For example, say the user logs in via the lobby on the client side of things.
- The user enters a user name and a password.
The client sends it to the server.
The server checks it against the database.
The servers replies to the client.
The client either grants or denies the user access.
Code: Select all
Received FROM [127.0.0.1]: !AUTH:user,pass;
(depending on whether not it authenticated)
Sent TO [127.0.0.1]: @AUTH:Successful Login!
OR
Sent TO [127.0.0.1]: @AUTH:Invalid username or password.
In order to check if the log in was successful we're pausing execution (*gasp*) for ~20 ms (local network lag) then searching the string for either "Success" or "Invalid".
One major flaw (of many) with this is the string's contents as a whole persist, so once a log in is successful all future log-ins will be successful regardless.
How do you orchestrate packets so that you know what the exact reply to a specific request is (for instance, a dynamic array of strings is one way that might work for my exact situation)?
We're not lectured at all in class, it's more of a "here's what the end goal, have at it" approach which I like a lot. It just feels like sometimes I'm doing everything in a really horrible way or even just reinventing the wheel (which is usually a valuable experience anyways).