I am sending the server a message. For example: "Hello World." I want the server to send back the message: "hello world."
for(;;) //listen forever
{
ClntLen = sizeof(ClntAddr);
NewSockfd = Accept(Sockfd, (sockaddr*)&ClntAddr, &ClntLen);
//Read message
read(NewSockfd, Buff, MAX_SIZE);
//convert to lower, send back to client
write(NewSockfd, Buff, MAX_SIZE);
close(NewSockfd);
}
I have tried using tolower(), but in a server I just can't get it right without giving me errors.
Summary: Read Buff (char array), convert it to lowercase, Write it back to the client.
Please explain how its done. Thanks in advance.