Hey guys. I figured out a way to organize the UI for the ECS program I am working on. After I recv() the message from the socket into buff, I could check if it received any message(if the buffer is not completely empty). if it id, then decrypt the message and then show it to the user. But if the buffer is empty, then don't print anything at all on the screen. Because right now, if the message is empty, it still prints "Message from client: " without the message
here is the code:
Just part of the code that I am talking about. I need to replace if(buff != ' ') with another condition. I need to check if there is anything in the buffer. I could do it with a loop through all the elements of the char and check, but I thought there was a function to do it.
if(frkserv > 0)
if(recv(clisock, &buff, sizeof(buff), 0) != NULL)
if(buff != ' ')
printf("Message from client: %s\n", buff);