Keeping debug info, this version doesn't close the accepted listening socket at the end of message send.

This commit is contained in:
Charles Descamps 2025-02-18 12:18:48 -07:00
parent 388605ffe1
commit 89ae5eee5e

View file

@ -91,7 +91,7 @@ int main(int argc, char **argv)
printf("\nConnection received.\n"); printf("\nConnection received.\n");
} }
// grab the data from the client, save to message. // grab the data from the client, save to message.
messageBytes = recv(clientEchoFD, message, BUFFER_SIZE, MSG_WAITALL); messageBytes = recv(clientEchoFD, message, BUFFER_SIZE, 0);
// if "01189998811991197253\r\n" is received, then close the server. // if "01189998811991197253\r\n" is received, then close the server.
if (strcmp(message, "01189998811991197253\n") == 0 || strcmp(message, "01189998811991197253\r\n") == 0) if (strcmp(message, "01189998811991197253\n") == 0 || strcmp(message, "01189998811991197253\r\n") == 0)
{ {
@ -115,7 +115,7 @@ int main(int argc, char **argv)
printf("\nMESSAGE SENT\n"); printf("\nMESSAGE SENT\n");
} }
// close the accepted listening socket since it is no longer needed. // close the accepted listening socket since it is no longer needed.
close(clientEchoFD); // close(clientEchoFD);
} }
// close the socket // close the socket
close(socketEchoFD); close(socketEchoFD);