From fc1d127a6b219c304b26519dcca8aaaa4b5cb21a Mon Sep 17 00:00:00 2001 From: cdez Date: Wed, 19 Feb 2025 20:07:06 -0700 Subject: [PATCH] using read and write instead --- echoserver/echoserver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/echoserver/echoserver.c b/echoserver/echoserver.c index 80e41e0..be239bf 100644 --- a/echoserver/echoserver.c +++ b/echoserver/echoserver.c @@ -121,7 +121,7 @@ int main(int argc, char **argv) // grab the client's socket information (not needed?) // check to see if the client socket is actually connected (not needed?) // grab the data from the client, save to message. - messageBytes = recv(fileIter, message, BUFFER_SIZE, 0); + messageBytes = read(fileIter, message, BUFFER_SIZE); // make sure that the connection is still open before attempting to send. if(messageBytes == 0) // old: messageBytes <= 0 { @@ -134,7 +134,7 @@ int main(int argc, char **argv) else { // if it is open, send the message back to the client over the client socket - send(fileIter, message, sizeof(message), 0); + write(fileIter, message, sizeof(message)); printf("\nMessage has been sent back to client.\n"); } printf("\nMessage received.\n");