Best way to handle incoming commands from a client.
My current idea for this would be to have a function inside my class that contains the socket that looks something like this:
My question is "Can it be done better?" I would hope to keep my input as a string but that could change as well the lagg times killed my last mmorpg attempt.
Code:
void VAA_Input(char* Command) //validate and act on input
{
switch(Command[0])
{
case 'a':
case 'A':
if(strncmp(Command,"Aquire_Item",11) == 0)
{
//run code to aquire specified item
}else
if(strcmp ...)
{
//do something
}else
break;
.
.
.
case 'z':
case Z':
break;
default:
//ignore it because it isn't a keyword
break;
}
}