Changeset cb1f288 in network-game for server/server.cpp
- Timestamp:
- Nov 23, 2012, 9:13:44 PM (12 years ago)
- Branches:
- master
- Children:
- 8efe484
- Parents:
- 6c92572
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/server.cpp
r6c92572 rcb1f288 58 58 error("binding"); 59 59 fromlen = sizeof(struct sockaddr_in); 60 while ( 1) {60 while (true) { 61 61 n = receiveMessage(&clientMsg, sock, &from); 62 62 if (n < 0) … … 64 64 cout << "msg: " << clientMsg.buffer << endl; 65 65 66 if (strcmp(clientMsg.buffer, "Hello") )66 if (strcmp(clientMsg.buffer, "Hello") == 0) 67 67 { 68 68 strcpy(serverMsg.buffer, "I'm thinking of a number between 1 and 1000. Guess what it is."); 69 69 }else { 70 70 int guess = atoi(clientMsg.buffer); 71 72 cout << "guess: " << guess << endl; 71 73 72 74 if (guess < 1 || guess > 1000) {
Note:
See TracChangeset
for help on using the changeset viewer.