Invalid command!

This commit is contained in:
Adrien Bourmault 2021-07-08 18:49:27 +02:00
parent ca7cb9294d
commit b5be741617
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
2 changed files with 7 additions and 2 deletions

View File

@ -69,7 +69,12 @@ void connectedCommunication(int sockfd)
// Reading server answer // Reading server answer
read(sockfd, receiveBuff, sizeof(receiveBuff)); read(sockfd, receiveBuff, sizeof(receiveBuff));
printf("%s\n", receiveBuff); // Detect null-string returned
if (receiveBuff[0] == 0) {
printLog("An error occured or invalid command!");
}
printf("%s\n\n", receiveBuff);
} }
} }

View File

@ -76,7 +76,7 @@ static void serverCommunicationInstance(Server_t *args, int sockfd)
} }
// Zeroing buffer // Zeroing buffer
snprintf(sendBuff, SEND_BUFFER_SIZE, "%s", "Invalid command!"); bzero(sendBuff, RECEIVE_BUFFER_SIZE);
// Execute command by first arg in cmdList // Execute command by first arg in cmdList
for (int i = 0; i < LEN(cmdList); i++) { for (int i = 0; i < LEN(cmdList); i++) {