title: Count the number of packets sent to a server from a client?
body: <p>So I'm almost done an assignment involving Win32 programming and sockets, but I have to generate and analyze some statistics about the transfers. The only part I'm having trouble with is how to figure out the number of packets that were sent to the server from the client.</p>
  
  <p>The data sent can be variable-length, so I can't just divide the total bytes received by a #define'd value.</p>
  
  <p>We have to use asynchronous calls to do everything, so I've been trying to increment a counter with every FD_READ message I get for the server's socket. However, because I have to be able to accept a potentially large file size, I have to call recv/recvfrom with a buffer size around 64k. If I send a small packet (a-z), there are no problems. But if I send a string of 1024 characters 10x, the server reports 2 or 3 packets received, but 0% data loss in terms of bytes sent/received.</p>
  
  <p>Any idea how to get the number of packets?</p>
  
  <p>Thanks in advance :)</p>