From da93ce1541a3fb3d7f9c234e421535b9a61d7e25 Mon Sep 17 00:00:00 2001 From: cdez Date: Thu, 20 Feb 2025 11:07:06 -0700 Subject: [PATCH] clean up the code, remove some of the 'CODE HERE' comments. retesting now. --- echoserver/echoserver.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/echoserver/echoserver.c b/echoserver/echoserver.c index a957a64..ad5e439 100644 --- a/echoserver/echoserver.c +++ b/echoserver/echoserver.c @@ -48,19 +48,15 @@ int main(int argc, char **argv) return -1; } // use fnctl to set the non-blocking flag for the socket - // CODE HERE fcntl(socketEchoFD, F_SETFL, O_NONBLOCK); // the server will now accept client connections by listening. listen(socketEchoFD, MAX_CONNECT_QUEUE); // create a file descriptor set, to keep track of the sockets in use using fd_set and FD_ZERO? - // CODE HERE fd_set socketList; FD_ZERO(&socketList); // add the socketEchoFD to the file descriptor set using fd_set - // CODE HERE FD_SET(socketEchoFD, &socketList); - // somehow have a max file descriptor, set this? - // CODE HERE + // max file descriptor, this will be used to 'find' the socket currently connected int maxFD = socketEchoFD; // while loop that will continue to listen for messages from clients. printf("Echoserver listening on port: %d\n", ECHOPORT); @@ -69,10 +65,8 @@ int main(int argc, char **argv) // somehow use the set of file descriptor sockets here // CODE HERE // use the select() function here to check the set of sockets - // CODE HERE int selectedFD = select(maxFD+1, &socketList, NULL, NULL, NULL); // check to make sure select() didn't error out. - // CODE HERE if(selectedFD == -1) { //