Used blocking recv here, to ensure that we wait for the server to respond
This commit is contained in:
		
							
								
								
									
										2
									
								
								main.cpp
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.cpp
									
									
									
									
									
								
							@@ -108,7 +108,7 @@ GameType check_server_client(int argc, char** argv) {
 | 
				
			|||||||
			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");
 | 
				
			||||||
			std::string msg_from_server = client->recvAllNB();
 | 
								std::string msg_from_server = client->recvAll();
 | 
				
			||||||
			if (msg_from_server == "U2") {
 | 
								if (msg_from_server == "U2") {
 | 
				
			||||||
				std::cout << "Connection made. Waiting for server to begin game..." << std::endl;
 | 
									std::cout << "Connection made. Waiting for server to begin game..." << std::endl;
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user