|
|
@ -62,14 +62,13 @@ GameType check_client(char* code_text) {
|
|
|
|
client->create_socket();
|
|
|
|
client->create_socket();
|
|
|
|
/* Send a specific message to the server, and wait for the appropriate response, to know that the server is ready */
|
|
|
|
/* Send a specific message to the server, and wait for the appropriate response, to know that the server is ready */
|
|
|
|
client->sendAll("GG");
|
|
|
|
client->sendAll("GG");
|
|
|
|
// display_text_centered("Connecting...");
|
|
|
|
std::string msg_from_server = client->recvAllNB();
|
|
|
|
std::string msg_from_server = client->recvAll();
|
|
|
|
|
|
|
|
if (msg_from_server == "U2") {
|
|
|
|
if (msg_from_server == "U2") {
|
|
|
|
display_text_centered("Connection made");
|
|
|
|
display_text_centered("Connection made");
|
|
|
|
Timer timer = timer_init(3);
|
|
|
|
Timer timer = timer_init(3);
|
|
|
|
while (!timer_done(timer));
|
|
|
|
while (!timer_done(timer));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
throw EXCEPT_WRONGRESPONSE;
|
|
|
|
throw std::invalid_argument("Server didn't respond with correct message.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
type.mode = M_CLIENT;
|
|
|
|
type.mode = M_CLIENT;
|
|
|
|
type.netsock = client;
|
|
|
|
type.netsock = client;
|
|
|
|