I set up the event with the lines:
hWSADataRecv = WSACreateEvent();
intRetVal = WSAEventSelect(intUDPDataSocket, hWSADataRecv, FD_READ);
intRetVal = CmtScheduleThreadPoolFunction
(hEtherThreadPool, etherDataPortRecv , 0, ðerDataPortRecvThreadFunctionID);
and then in the thread use the lines:
while(intQuitting == 0)
{
if((dwEvent = WSAWaitForMultipleEvents(1, &hWSADataRecv, TRUE, 100, FALSE))
== WSA_WAIT_EVENT_0)
{
if((intRetVal = WSARecvFrom(intUDPDataSocket, &DataBuf, 1, &dwBytesRecv, &dwFlags,
(SOCKADDR *)&AddrDestData, &intAddrSize, &Overlapped, NULL)) < 0)
---------------------
This starts fine and waits for an incomming packet.
As soon as the first packet arrives WSAWaitForMultipleEvents fires as fast as it can and WSARecvFrom emits error 10035 (WSAWouldBlock). The socket has been set to non blocking by WSAEventSelect.
In Sockets Help under WSAWaitForMultipleEvents, the comment below occurs:
no further actions are taken for that
network event until the application makes the function call that implicitly
reenables the setting of that network event and signaling of the associated
event object.
What function call can I make to reset the event?
Thanks.