title: HTTP keep-alive with C++ recv winsocket2
body: <p>I'm Coding my own HTTP fetcher socket. I use C++ in MVC++ and winsocket2.h 
  I was able to program the socket to connect to the required website's server  and send an HTTP GET request.</p>
  
  <p>Now the problem is after I send an HTTP GET request with Keep-alive connection, I call the recv function , and it works fine except after it retrieves  the website, it stays lingering and waiting for time-out hint from the server or a connection to close!!</p>
  
  <p>This takes a few seconds of less depending in the keep-alive timeout the servers has, 
  Therefore, I can't benefit from the keep-alive HTTP settings. </p>
  
  <p>How can I tell the recv function to stop after retrieving the website and gives back the command to me so I can send another HTTP request while avoiding another hand-shake regime.</p>
  
  <p>When I use the non-blocking sockets it works faster, But I don't know when to stop, I set a str.rfind("",-1,7) to stop retrieving  data.
  however, it is not very efficient.</p>
  
  <p>Does anybody know a way to do it, or what is that last character send by the HTTP server when the connection is kept alive, so I can use it as a stopping decision.</p>
  
  <p>Best,<br>
  Moe</p>