title: how to receive the large data using recv()?
body: <p>i developed client server program using c++,so i want to receive more than 500kb  ,   my client message is terminated with "!" ,so i want to receive until my last byte(!) receive ,
  this is my code it doesn't work.what is wrong with it.</p>
  
  <pre><code>do
    {
    int num = recv(*csock,  buf, bytesLeft,0);
  
  if (num == 0)
  {
    break;
  }
  else if (num &lt; 0 &amp;&amp; errno != EINTR)
  {
    fprintf(stderr, "Exit %d\n", __LINE__);
    exit(1);
  }
  else if (num &gt; 0)
  {
    numRd += num;
    buf += num;
    bytesLeft -= num;
    fprintf(stderr, "read %d bytes - remaining = %d\n", num, bytesLeft);
  }
  
    }
  
      while (bytesLeft != 0);
     fprintf(stderr, "read total of %d bytes\n", numRd);
  </code></pre>