Skip to content
Snippets Groups Projects
Commit 6bb93818 authored by ChouTatsumi's avatar ChouTatsumi
Browse files

input sockfd test

parent 325c7384
No related branches found
No related tags found
No related merge requests found
...@@ -184,11 +184,17 @@ int create_server_socket(const char* ip, const int port) { ...@@ -184,11 +184,17 @@ int create_server_socket(const char* ip, const int port) {
} }
static bool handle_http_request(int sockfd) { static bool handle_http_request(int sockfd) {
printf("Here comes sockfd %d\r\n", sockfd);
// players setting and detecting // players setting and detecting
if (p1_sockfd < 0) if (p1_sockfd < 0) {
p1_sockfd = sockfd; p1_sockfd = sockfd;
else if (p2_sockfd < 0) printf("p1_sockfd set to sockfd %d\r\n", sockfd);
}
else if (p2_sockfd < 0) {
p2_sockfd = sockfd; p2_sockfd = sockfd;
printf("p2_sockfd set to sockfd %d\r\n", sockfd);
}
else if (sockfd != p1_sockfd && sockfd != p2_sockfd) { else if (sockfd != p1_sockfd && sockfd != p2_sockfd) {
perror("more than 2 players"); perror("more than 2 players");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment