title: How to stop receiving data from socket C/C++
body: <p>the key is that I send 4096 bytes but only 119 bytes aprox. carry useful information.</p>
  
  <p>The 100 bytes ends with \r\n\r\n so in the client, when I read \r\n\r\n I want to stop receiving information from that string, and start over.</p>
  
  <p>I don't know if I have to flush, or close the socket, or whatever...</p>
  
  <p>They are sockets TCP.</p>
  
  <p>In the <strong>client</strong> I do:</p>
  
  <pre><code> buf details[4096];
   strcpy(details,"1");
   strcat(details,"10/04/12");
   strcat(details,"Kevin Fire");
   strcat(detils,"abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde\r\n\r\n");
   nbytes_sent = send(sock,(char *)details,sizeof(details),0);
  </code></pre>
  
  <p>On the other hand, the <strong>server</strong>...</p>
  
  <pre><code>char buf[20];
  memset(buf,'\0',20);
  
  while(!end){
   nbytes_read=recv(sclient,(char *)ress,sizeof(ress),0);
  
   if(strcmp(ress,"1")==0){
     printf("Details: %s (%i)\n",buf,nbytes_read);
     while(strcmp(buf,"\r\n\r\n") != 0){
       nbytes_read=recv(sclient,(char *)buf,sizeof(buf),0);
       cout.flush();
       printf("Details: %s (%i)\n",buf,nbytes_read);
     }                                     }
     if(strcmp(buf,"\r\n\r\n")==0) printf("The End\n");
     cout.flush();
   }
  }
  </code></pre>
  
  <p>I just want to read a new "ress" and not being retrieving the rest of bytes that are not useful.</p>
  
  <p>Thanks in advance.</p>