title: recvfrom() not getting everything
body: <p>I'm having some issues with recvfrom() not getting all the packets in C++. (and then blocking and not returning)</p>
  
  <p>I send 1 query packet, and then a response is sent.
  <br/>It's broken into multiple packets of 805 bytes and then ended with a packet of ~200 bytes.<br/>
  From my tests, 54 packets are received in total.
  <br/><br/>However, my program is only receiving 25-35 packets total, and not the ending packet, although the packets seem to be arriving fine in WireShark.</p>
  
  <p>My code can be seen here:</p>
  
  <pre><code>sockaddr_in local, dest;
  local.sin_family = AF_INET;
  local.sin_port = htons(58770);
  local.sin_addr.S_un.S_addr = INADDR_ANY;
  
  dest.sin_family = AF_INET;
  dest.sin_addr.S_un.S_addr = inet_addr(QUERYADDR);
  dest.sin_port = htons(20810);
  
  SOCKET s;
  if((s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
      errex("socket() failed");
  
  if(bind(s, (sockaddr*)&amp;local, sizeof(local)) == -1)
      errex("bind() failed!");
  
  sendto(s, (const char*)QUERY, sizeof(QUERY), 0, (sockaddr*)&amp;dest, sizeof(dest));
  
  while(true)
  {
      sockaddr_in tsaddr;
      char buf[8192];
  
      int slcl = sizeof(tsaddr);
      int res = recvfrom(s, buf, sizeof(buf), 0, (sockaddr*)&amp;tsaddr, &amp;slcl);
      printf("%i\n", res);
  }
  
  closesocket(s);
  WSACleanup();
  </code></pre>
  
  <p>Can anyone see anything wrong?</p>