diff --git a/server.cpp b/server.cpp index 5beddbe..2eb3b50 100644 --- a/server.cpp +++ b/server.cpp @@ -190,7 +190,7 @@ void *clientCommunication(void *data) return NULL; } - std::string incomplete_message; + std::string incomplete_message = ""; do { size = recv(*current_socket, buffer, BUF - 1, 0); @@ -267,11 +267,13 @@ void *clientCommunication(void *data) break; } - if (send(*current_socket, "OK", 3, 0) == -1) { + if (send(*current_socket, "OK\n", 3, 0) == -1) { perror("send answer failed"); return NULL; } + incomplete_message.clear(); + } while (strcmp(buffer, "quit") != 0 && !abortRequested); // closes/frees the descriptor if not already