Opengl + socket !!! Flush socket buffer???

I wrote a battleship game in OpenGL with socket.
The client code communicate with server like this
turn = 1;


void myMouse(){
        ...
        if(turn){
            printf("myMouse: Fire a missle
");
            sendline[0] = rowAttack + 48;
            sendline[1] = colAttack + 48;
            sendline[2] = '\0';
            //Attack the opponent
            Write(sockfd, sendline, MAXLINE);
            //Read the result of my attack
            Read(sockfd, recvline, MAXLINE);
            if(recvline[0] == 'w'){
               printf("myMouse: you won the game
");
            }else if(recvline[0] == 'h'){
               printf("myMouse: you hit
");
            }else if(recvline[0] == 'm'){
               printf("myMouse: you miss
");
            }
         }
         turn = 0;
}

then in my Idle function


void myIdle(){
    if(!turn){
      printf("Idle: Read the attack
");
      //Receive the attack and process whether it's a hit or not
      Read(sockfd, recvline, MAXLINE);******************************
      localrow = recvline[0] - 48;
      localcol = recvline[1] - 48;
      if(board2[localrow][localcol]){
         point--;
         if(point>0){
            printf("Idle: hit
");
            sendline[0] = 'h';
            sendline[1] = '\0';
         }else if(point == 0){
            sendline[0] = 'w';
            sendline[1] = '\0';
         }
      }else{
         printf("Idle: you miss
");
         sendline[0] = 'm';
         sendline[1] = '\0';
      }
      turn = 1;
      Write(sockfd, sendline, MAXLINE);
   }  
}

And in the server code I check if the same player attack twice.
Here is the dilemma. User 1 click on the board to attack and immediately read back the result from his attack. Idle responsible for send the result back. But if user 1 try to attack twice then, strange thing start to happen. After the first attack, right now it should sit the myIdle() trying to read in something (where the stars is). If user 1 try to attack twice or three timeā€¦, seems like the program queue up his attack, and when user 2 click on the board. All the attack from user1 click got draw. So instead of sending the attack to the server, which then detect as an attack from the same client, Now it is a valid attack, because it queue up the attack and wait for the user 2 to attack. How can I fix this problem? Thank you

This is an OpenGL forum. You need a networking/general gaming forum.