title: Why recv() in winsock client cannot get any data once httpRetransmition happens?
body: <p>I am trying to record the time between 'http request' package and 'http response' package.</p>
  
  <p>I write an socket client using winsock. The code is below</p>
  
  <pre><code>        if (send(sock, request.c_str(), request.length(), 0) != request.length())
              die_with_error("send() sent a different number of bytes than expected");
  
          // Record the time of httpRequestSent
          ::QueryPerformanceCounter(&amp;httpRequestSent);
          ::QueryPerformanceFrequency(&amp;frequency);
  
          //get response
          response = "";
          resp_leng= BUFFERSIZE;
          http_leng= 381;
          while(resp_leng==BUFFERSIZE||http_leng&gt;0)
          {
              resp_leng= recv(sock, (char*)&amp;buffer, BUFFERSIZE, 0);
              http_leng= http_leng - resp_leng;
              if (resp_leng&gt;0)
                  response+= string(buffer).substr(0,resp_leng);
              //note: download lag is not handled in this code
          }
  
          ::QueryPerformanceCounter(&amp;httpResponseGot);
  
          //display response
          cout &lt;&lt; response &lt;&lt; endl;
  
          // Display the HTTP duration
          httpDuration = (double)(httpResponseGot.QuadPart - httpRequestSent.QuadPart) / (double)frequency.QuadPart;
          printf("The HTTP duration is %lf\n", httpDuration);
  </code></pre>
  
  <p>The code works nicely except one situation: HTTP Retransmition. I used wireshark to monitor packages and found out once there is a retransmition the code seems block on recv(), but cannot get any data from the socket buffer. I wonder why would this happen. Could somebody explain the reasons? 
  Any help will be appreciated.</p>