This is a piece of my code down below, I have created a server and client which can communicate with each other. Everything works fine but when I add a space character to my message the program treats them as two different strings, meaning two different messages.
So when I type Hello I get back
Content-Length: 5;Hello
But When I type Hello dude I get back
Content-Length: 5;Hello
Content-Length: 4;dude
Here is the source code of the client who sends the message. To receive the messages I have created threads, but they all work fine. I assume this has to do with how send() function treats the space character . My question is, how do I get it to treat as if it was a real character?
  char msgtobesent[256];
  memset(msgtobesent, '\0', 256);
  while(TRUE){
    scanf("%s", msgtobesent);
    int ll = strlen(msgtobesent);
    char theTotalMessage[19];
  //  memset(theTotalMessage, '\0', sizeof(theTotalMessage));
    sprintf(theTotalMessage, "Content-Length: %d;", ll);
    strcat(theTotalMessage, msgtobesent);
    printf("theTotalMessage: %s\n", theTotalMessage);
    send(connection, theTotalMessage, strlen(theTotalMessage) + 1, 0);
  }
 
    