Strange packet being returned from an IOCP call. RRS feed

  • Question

  • EDIT: My problem wasn't quite what I thought it was.  I have a sample IOCP server program.   After I AcceptEx a new socket, dequeue my first packet, and post the first WSARecv, I start getting a rather strange response from GetQueuedCompletionStatus.   Here's an example.  Say the client sends me two packets at once, a string "teststring", followed by a cr/lf pair.    I get the following responses from GQCS:

    Packet 1:  buffer: "teststring", numbytes=10, OVERLAPPED.InternalHigh=10.

    Packet 2: buffer: "(cr)(lf)", numbytes = 2, OVERLAPPED.InternalHigh=2.

    Packet 3: buffer: "(all nulls)", numbytes =2, OVERLAPPED.InternalHigh=0, OVERLAPPED.Internal = 259.

    The first two are what I would expect.  The third is the strange one.  An empty buffer, InternalHigh (which I thought was supposed to match the # of bytes transferred) is zero, and the Internal member = 259, which is apparently the code STATUS_PENDING.

    If I ignore this packet entirely, everything seems to work OK, but I'm confused why the port is even sending it to me?  I've already gotten a WSA_IO_PENDING result back from the initial WSARecv, so why does the port need to do a kernel transition just to tell me nothing is ready for me yet?

    Saturday, August 28, 2010 7:20 AM

All replies