1

i am using Winsock2 in conjunction with overlapped I/O. This means i am calling WSARecv with a WSAOVERLAPPED structure and later i wait with WSAWaitForMultipleEvents for data.

I made the strange observation that i seem to loose any data that is send to my application while i am halting it with the debugger. I thought this data would pile up somewhere in the OS and then be delivered on the next call to WSARecv.

Is my assumption false?

MrZomg
  • 11
  • 1
  • there has to be some error some where else in your code, the situation you described shouldn't generate that bug, and there is somewhere in the OS that data pileup if not delivered to your program. but OS has some limits itself, I don't know what would happen if it overflow. – Ali1S232 Jun 10 '11 at 20:21
  • i investigated a bit further and i see the data pile up in the buffer assciated with WSAOVERLAPPED in the debugger. i simply seem not to receive any event for this data. When the next chunk of data is received the buffer gets simply overwritten and i may see a event for the new data. really strange. – MrZomg Jun 10 '11 at 23:26

1 Answers1

1

UDP or TCP?

I assume you ARE using a separate OVERLAPPED structure per call and a separate event per structure.

Bear in mind that it's not especially scalable to use the overlapped I/O with events, it's much easier to simply associate the socket with an I/O Completion Port and skip the whole event thing completely.

Len Holgate
  • 21,282
  • 4
  • 45
  • 92
  • its for TCP. i ZeroMemory the overlapped structure after it has been used and i WASResetEvent the used Event as well. The strange thing is that it is working fine when not paused by the debugger. Shouldn't any errors regardning misuse of events/overlapped structures be present then as well? – MrZomg Jun 12 '11 at 12:11
  • Yes, but the debugger may cause any race conditions to show up more often... Can we see some code? – Len Holgate Jun 12 '11 at 16:23