title: Multiple calls to send() are merged into one call to recv()
body: <p>I have a client-server application. </p>
  
  <p>The client is sending a string followed by an integer using two distinct <code>send()</code> calls. These two data are supposed to be stored into two different variables on the server. </p>
  
  <p>The problem is that both variables sent are received on <code>recv()</code> call. Therefore, the two strings sent by the two distinct <code>send()</code>s are chained and stored in the buffer of the first <code>recv()</code>.</p>
  
  <p>server.c: </p>
  
  <pre><code>printf("Incoming connection from client %s:%i accepted\n",inet_ntoa(clientSocketAddress.sin_addr),ntohs(clientSocketAddress.sin_port));
  
  
  memset(buffer,0,sizeof(buffer));
  int sizeofMessage;
  if ((recv(clientSocket,buffer,MAXBUFFERSIZE,0)==sizeofMessage)&lt;0)
  {
    printf("recv failed.");
    closesocket(serverSocket);
    clearWinsock();
    return EXIT_FAILURE;
  }
  
  char* Name=buffer;
  printf("Name: %s\n",Name);
  
  if ((recv(clientSocket,buffer,MAXBUFFERSIZE,0))&lt;0)
  {
    printf("bind failed.");
  
    closesocket(serverSocket);
    clearWinsock();
    return EXIT_FAILURE;
  }
  
  int integer=ntohs(atoi(buffer));
  printf("integer: %i\n",intero);
  </code></pre>
  
  <p>client.c:</p>
  
  <pre><code>if (send(clientSocket,Name,strlen(Name),0)!=strlen(Name))
  {
    printf("send failed");
  
    closesocket(clientSocket);
    clearWinsock();
    return EXIT_FAILURE;
  }
  
  printf("client send: %s",Name);
  
  int age=35;
  itoa(htons(age),buffer,10);
  sizeofBuffer=strlen(buffer);
  if (send(clientSocket,buffer,sizeofBuffer,0)!=sizeofBuffer)
  {
    printf("bind failed.");
  
    closesocket(clientSocket);
    clearWinsock();
    return EXIT_FAILURE;
  }
  </code></pre>
  
  <p>How can I fix it? What am I doing wrong? </p>