Client side waiting for client to connect
Closed this issue · 1 comments
Client side, a waiting client should wait for a flag which means that the client has connected
the flag will be an integer.
should be set to:
isOtherPlayerConnected = FALSE.
at first
it should be blocking, IE
printf('Waiting for other player to connect...");
recv(sockfd, &isOtherPlayerConnected, sizeof(int), 0);
//\
Client Logic
////////
(recv is blocking by description)
All this issue is now is a printf call.
Serverside I left the interactions between server-client essentially the same, which negates the need for a while loop in the client, since the client will just get stuck in a blocking recv() call whilst the server sorts it stuff out and gets another player matched.
So, before that first block recv() call, all that is needed is a
printf("Waiting for the opposing player to connect!");
or something along those lines