Changeset 8efe484 in network-game for client/Client/main.cpp


Ignore:
Timestamp:
Nov 23, 2012, 9:33:32 PM (12 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
e08572c
Parents:
cb1f288
Message:

Configured the client so it launches proplerly directly from Visual Studio

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    rcb1f288 r8efe484  
    6464        server.sin_port = htons(atoi(argv[2]));
    6565
     66        strcpy(msgTo.buffer, "Hello");
     67        n=sendMessage(&msgTo, sock, &server);
     68        if (n < 0)
     69                error("sendMessage");
     70
     71        n = receiveMessage(&msgFrom, sock, &from);
     72        if (n < 0)
     73                error("receiveMessage");
     74       
     75        cout << msgFrom.buffer << endl;
     76
    6677        while(true) {
    67                 cout << "Please enter the message: ";
     78                cout << "Please enter a message (or q to quit): ";
    6879                cin.getline(msgTo.buffer, 256);
    6980               
    70                 if (strcmp(msgTo.buffer, "quit") == 0) {
     81                if (strcmp(msgTo.buffer, "q") == 0) {
    7182                        break;
    7283                }
    7384
    74                 socklen_t socklen = sizeof(server);
    7585                n=sendMessage(&msgTo, sock, &server);
    7686                if (n < 0)
     
    8494        }
    8595
    86         cout << "Thank you for playing!" << endl;
    87 
    8896        closesocket(sock);
    8997
    9098        WSACleanup();
     99
     100        cout << "Thank you for playing!" << endl;
     101        getchar();
    91102
    92103        return 0;
Note: See TracChangeset for help on using the changeset viewer.