Changeset a4db787 in network-game


Ignore:
Timestamp:
Nov 26, 2012, 9:00:11 PM (12 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
4da5aa3
Parents:
633f42a
Message:

Remove length check from sendMessage and receiveMessage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    r633f42a ra4db787  
    138138   al_flip_display();
    139139
    140    int sock, n;
     140   int sock;
    141141   struct sockaddr_in server, from;
    142142   struct hostent *hp;
     
    207207                     msgTo.type = MSG_TYPE_LOGIN;
    208208                     username = input;
     209
    209210                     break;
    210211                  }
     
    220221                     else
    221222                        msgTo.type = MSG_TYPE_CHAT;
     223
    222224                     break;
    223225                  }
     
    236238               }
    237239
    238                n=sendMessage(&msgTo, sock, &server);
    239                if (n < 0)
    240                   error("sendMessage");
    241 
    242                n = receiveMessage(&msgFrom, sock, &from);
    243                if (n < 0)
    244                   error("receiveMessage");
    245 
     240               sendMessage(&msgTo, sock, &server);
     241
     242               receiveMessage(&msgFrom, sock, &from);
    246243               string response = string(msgFrom.buffer);
    247244
     245               // this whole select block should go in a new function.
     246               // Figure out how to pass and return params properly
    248247               switch(state)
    249248               {
     
    262261                        state = STATE_LOGIN;
    263262                     }
     263
    264264                     break;
    265265                  }
Note: See TracChangeset for help on using the changeset viewer.