[Tux4kids-commits] r1050 - tuxmath/branches/lan/server
akash gangil
gangil-guest at alioth.debian.org
Mon Jun 15 10:15:45 UTC 2009
Author: gangil-guest
Date: 2009-06-15 10:15:44 +0000 (Mon, 15 Jun 2009)
New Revision: 1050
Modified:
tuxmath/branches/lan/server/server.c
tuxmath/branches/lan/server/testclient.c
Log:
more readable flashcard and reinitialising switch variable
Modified: tuxmath/branches/lan/server/server.c
===================================================================
--- tuxmath/branches/lan/server/server.c 2009-06-15 09:59:03 UTC (rev 1049)
+++ tuxmath/branches/lan/server/server.c 2009-06-15 10:15:44 UTC (rev 1050)
@@ -82,6 +82,7 @@
if (SDLNet_TCP_Recv(csd, buffer, 512) > 0)
{
+ network_function = -1;
printf("Client say: %s\n", buffer);
//'a' for the setting up the question list
@@ -144,11 +145,12 @@
/* no more questions available - cannot create comet. */
return 0;
}
-
- printf("WILL SEND >> %s\n",fc->formula_string);
- printf(" %s\n",fc->answer_string);
- printf(" %d\n",fc->answer);
- printf(" %d\n",fc->difficulty);
+
+ printf("WILL SEND >>\n");
+ printf("FORMULA_STRING : %s\n",fc->formula_string);
+ printf("ANSWER STRING : %s\n",fc->answer_string);
+ printf("ANSWER : %d\n",fc->answer);
+ printf("DIFFICULTY : %d\n",fc->difficulty);
@@ -158,7 +160,11 @@
}
break;
- }
+ }
+
+
+ default:
+ break;
}
@@ -197,27 +203,27 @@
int x;
x=SDLNet_TCP_Send(csd,&(fc->difficulty),sizeof(fc->difficulty));
- printf("no:(1):::::::Sent %d bytes\n",x);
+ printf("no:(1):::DIFFICULTY::::Sent %d bytes\n",x);
// SDLNet_TCP_Recv(csd,ch,1); //will send in the next item only when the first one is receive
// if(*ch=='1')
// {
x=SDLNet_TCP_Send(csd,&(fc->answer),sizeof(fc->answer));
- printf("no:(2):::::::Sent %d bytes\n",x);
+ printf("no:(2)::::ANSWER:::Sent %d bytes\n",x);
// SDLNet_TCP_Recv(csd,ch,1);
// if(*ch=='1')
// {
x=SDLNet_TCP_Send(csd,fc->answer_string,strlen(fc->answer_string)+1);
- printf("no:(3):::::::Sent %d bytes\n",x);
+ printf("no:(3):::ANSWER_STRING::::Sent %d bytes\n",x);
// SDLNet_TCP_Recv(csd,ch,1);
// if(*ch=='1')
// {
x=SDLNet_TCP_Send(csd,fc->formula_string,strlen(fc->formula_string)+1);
- printf("no:(4):::::::Sent %d bytes\n",x);
+ printf("no:(4):::FORMULA_STRING::::Sent %d bytes\n",x);
// SDLNet_TCP_Recv(csd,ch,1);
Modified: tuxmath/branches/lan/server/testclient.c
===================================================================
--- tuxmath/branches/lan/server/testclient.c 2009-06-15 09:59:03 UTC (rev 1049)
+++ tuxmath/branches/lan/server/testclient.c 2009-06-15 10:15:44 UTC (rev 1050)
@@ -113,34 +113,34 @@
int RecvQuestion(MC_FlashCard* fc) //function to receive a flashcard(question) by the client
{
- char ch[5];
- int x,i=0;
+ char ch[5];
+ int x,i=0;
-x=SDLNet_TCP_Recv(sd,&(fc->difficulty),sizeof(fc->difficulty));
- printf("no:(1):::::::Received %d bytes\n",x);
- printf("RECEIVED >> %d\n",fc->difficulty);
-
+ x=SDLNet_TCP_Recv(sd,&(fc->difficulty),sizeof(fc->difficulty));
+ printf("no:(1):::DIFFICULTY::::Received %d bytes\n",x);
+
// SDLNet_TCP_Send(sd,ch,1); // send a conformation that the 1st item has been received
- x=SDLNet_TCP_Recv(sd,&(fc->answer),sizeof(fc->answer));
-
- printf("no:(2):::::::Received %d bytes\n",x);
- printf("RECEIVED >> %d\n",fc->answer);
+ x=SDLNet_TCP_Recv(sd,&(fc->answer),sizeof(fc->answer));
+ printf("no:(2):::ANSWER::::Received %d bytes\n",x);
// SDLNet_TCP_Send(sd,ch,1);
do{
x=SDLNet_TCP_Recv(sd,&ch[i],1);
- printf("<<<%d>>>no:(3):::::::Received %d bytes\n",i,x);
+ printf("<<<SUB-PACKET%d>>>no:(3):::ANSWER_STRING::::Received %d bytes\n",i,x);
i++;
}while(ch[i-1]!='\0');
strncpy(fc->answer_string,ch,i+1);
- printf("RECEIVED >> %s\n",fc->answer_string);
// SDLNet_TCP_Send(sd,ch,1);
-x=SDLNet_TCP_Recv(sd,fc->formula_string,13);
+ x=SDLNet_TCP_Recv(sd,fc->formula_string,13);
+ printf("no:(4):::FORMULA_STRING::::Received %d bytes\n",x);
- printf("no:(4):::::::Received %d bytes\n",x);
- printf("RECEIVED >> %s\n",fc->formula_string);
+ printf("RECEIVED >>\n");
+ printf("DIFFICULTY >> %d\n",fc->difficulty);
+ printf("ANSWER >> %d\n",fc->answer);
+ printf("ANSWER_STRING >> %s\n",fc->answer_string);
+ printf("FORMULA_STRING >> %s\n",fc->formula_string);
// SDLNet_TCP_Send(sd,ch,1);
More information about the Tux4kids-commits
mailing list