Hi all,

I'm in the process of writing a Client / Server Application, the Server is a PC and the Client is a Nintendo DS. The server side is written VB and the Client in C. I've got it working but I'm not convinced that my C code is up to much.

There's a very simple application protocol but I seem to have to use a lot of code to actually parse the data received from the Server. Below is the code I am currently using. Is there a better way of performing the parsing operation ?
Code:
/*
If a confirmation of connection was received (0x02)
tell the user we're connected.
Otherwise parse the data received
and take appropriate action
App. Protocol:
	Hex(02)	Successfully Connected to Controller
	D,char	where char is Date 
	L,char	where char is the Location
	R,int	where int = Number Rounds
	Q,int	where int = Number of Questions (Not Implemented yet)
	T,char	where char = Team Name
*/
if (strncmp(recBuff,"\x02",1) == 0) 
{
	printTop("Connected");
} 
else
{
	if(sscanf(recBuff,"%c,",&cmd) == 1)
	{
		if(strncmp(&cmd,"D",1) == 0)
		{
			if(sscanf(recBuff,"%c,%[^\n]s",&cmd,argcharD) == 2)
			{
				printat(1,1,argcharD);
			}
		}
		if(strncmp(&cmd,"L",1) == 0)
		{
			if(sscanf(recBuff,"%c,%[^\n]s", &cmd,argcharL) == 2)
			{
				printat(1,2,argcharL);
			}
		}
		if(strncmp(&cmd,"R",1) == 0)
		{
			if(sscanf(recBuff,"%c,%d",&cmd,&num) == 2)
			{
                                       Do_RoundButtons(num);				             	}
		}
		if(strncmp(&cmd,"T",1) == 0)
		{
			if(sscanf(recBuff,"%c,%[^\n]s",&cmd,argcharT) == 2)
			{
				if(strncmp(argcharT,"END",3) != 0)
				{
					xp = 1;
					Do_ShowTeam(xp,yp,argcharT);
					yp = yp+3;
					teams++;
				}
                                                   else
				{
					yp=1;
				}
			}
		}
	}	
}