[Tux4kids-commits] r1043 - tuxmath/branches/lan/server
akash gangil
gangil-guest at alioth.debian.org
Sat Jun 13 19:59:40 UTC 2009
Author: gangil-guest
Date: 2009-06-13 19:59:38 +0000 (Sat, 13 Jun 2009)
New Revision: 1043
Modified:
tuxmath/branches/lan/server/server.c
tuxmath/branches/lan/server/testclient.c
Log:
only max_answer_size and max_formula_size issues to solve
Modified: tuxmath/branches/lan/server/server.c
===================================================================
--- tuxmath/branches/lan/server/server.c 2009-06-13 17:52:59 UTC (rev 1042)
+++ tuxmath/branches/lan/server/server.c 2009-06-13 19:59:38 UTC (rev 1043)
@@ -194,29 +194,32 @@
int SendQuestion(MC_FlashCard* fc) //function to send a flashcard(question) from the server to the client
{
char *ch;
+ int x;
-
- SDLNet_TCP_Send(csd,fc->formula_string,strlen(fc->formula_string));
-
- printf("%d\n",strlen(fc->formula_string));
+ x=SDLNet_TCP_Send(csd,&(fc->difficulty),sizeof(fc->difficulty));
+ printf("no:(1):::::::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')
// {
- SDLNet_TCP_Send(csd,fc->answer_string,strlen(fc->answer_string));
-
- printf("%d\n",strlen(fc->answer_string));
+ x=SDLNet_TCP_Send(csd,&(fc->answer),sizeof(fc->answer));
+
+ printf("no:(2):::::::Sent %d bytes\n",x);
// SDLNet_TCP_Recv(csd,ch,1);
// if(*ch=='1')
// {
- SDLNet_TCP_Send(csd,&(fc->answer),sizeof(fc->answer));
- printf("%d\n",sizeof(fc->answer));
+ x=SDLNet_TCP_Send(csd,fc->answer_string,strlen(fc->answer_string));
+
+ printf("no:(3):::::::Sent %d bytes\n",x);
+
// SDLNet_TCP_Recv(csd,ch,1);
// if(*ch=='1')
// {
- SDLNet_TCP_Send(csd,&(fc->difficulty),sizeof(fc->difficulty));
- printf("%d\n",sizeof(fc->difficulty));
+ x=SDLNet_TCP_Send(csd,fc->formula_string,strlen(fc->formula_string));
+ printf("no:(4):::::::Sent %d bytes\n",x);
+
+
// SDLNet_TCP_Recv(csd,ch,1);
// if(*ch=='1')
// {
Modified: tuxmath/branches/lan/server/testclient.c
===================================================================
--- tuxmath/branches/lan/server/testclient.c 2009-06-13 17:52:59 UTC (rev 1042)
+++ tuxmath/branches/lan/server/testclient.c 2009-06-13 19:59:38 UTC (rev 1043)
@@ -114,28 +114,34 @@
int RecvQuestion(MC_FlashCard* fc) //function to receive a flashcard(question) by the client
{
char *ch="1";
+ int x;
+x=SDLNet_TCP_Recv(sd,&(fc->difficulty),sizeof(fc->difficulty));
+ printf("no:(1):::::::Received %d bytes\n",x);
+ printf("RECEIVED >> %d\n",fc->difficulty);
- SDLNet_TCP_Recv(sd,fc->formula_string,strlen(fc->formula_string)+1);
-
- printf("%d\n",strlen(fc->formula_string));
- printf("RECEIVED >> %s\n",fc->formula_string);
-// SDLNet_TCP_Send(sd,ch,1); // send a conformation that the 1st item has been received
- SDLNet_TCP_Recv(sd,fc->answer_string,strlen(fc->answer_string)+1);
-
- printf("%d\n",strlen(fc->answer_string));
- printf("RECEIVED >> %s\n",fc->answer_string);
-// SDLNet_TCP_Send(sd,ch,1);
- SDLNet_TCP_Recv(sd,&(fc->answer),sizeof(fc->answer));
+ // 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("%d\n",sizeof(fc->answer));
+ printf("no:(2):::::::Received %d bytes\n",x);
printf("RECEIVED >> %d\n",fc->answer);
+
+
// SDLNet_TCP_Send(sd,ch,1);
- SDLNet_TCP_Recv(sd,&(fc->difficulty),sizeof(fc->difficulty));
- printf("%d\n",sizeof(fc->difficulty));
- printf("RECEIVED >> %d\n",fc->difficulty);
+
+ x=SDLNet_TCP_Recv(sd,fc->answer_string,1);
+
+ printf("no:(3):::::::Received %d bytes\n",x);
+ printf("RECEIVED >> %s\n",fc->answer_string);
+
// SDLNet_TCP_Send(sd,ch,1);
+x=SDLNet_TCP_Recv(sd,fc->formula_string,strlen(fc->formula_string)+1);
+ printf("no:(4):::::::Received %d bytes\n",x);
+ printf("RECEIVED >> %s\n",fc->formula_string);
+
+ // SDLNet_TCP_Send(sd,ch,1);
+
return 1;
}
More information about the Tux4kids-commits
mailing list