I have used WSACreatEvent and WSAEventSelect to provide the event for WSAWaitForMultipleEvents.
I want the function below that is in its own thread to wait for the event and then call recvfrom. I put the line
SetCtrlVal(hpnlSimpleEthHost, pnlEthHost_numCount, intTemp1);
in to see how often the event is occurring. This only occurs with error 10035 returned from recvfrom
When first started the event occurs slowly but regularly. After the first message is received the count rate goes way up and the CPU usage goes to 97%.
The same happens to a second socket and its threaded receive function. Although both of first two threads receive, a third thread does not.
It seems inappropriate for there to be so many events occuring.
Ethereal only shows the traffic that I expect so I don't see why the events should be occuring.
This thread is using a jumbo frame of 8192 bytes.
What should I do?
Thanks, archieb
//------------------------------
int CVICALLBACK etherDataPortRecv (void *functionData)
{
DWORD dwEvent = 0;
int intNumBytesRecv = 0, fromSize = 0, intBufferPosition = 0, strBufLen = 32768, intTemp, intTemp1 = 0;
char strTemp0[150];
fromSize = sizeof(AddrDestData);
while(intQuitting == 0)
{
if((dwEvent = WSAWaitForMultipleEvents(1, &hWSADataRecv, FALSE, 100, FALSE))
!= WSA_WAIT_FAILED)
{
if((intNumBytesRecv = recvfrom(intUDPDataSocket, &ucDataBuf0[intBufferPosition], strBufLen, 0,
(LPSOCKADDR)&AddrDestData, &fromSize)) < 0)
{
intTemp = WSAGetLastError();
if(intTemp != 10035)
{
Fmt(strTemp0, "%s<Return, %i; LastWSAError, %i", intRetVal, intTemp);
MessagePopup("WSARecvDataFrom Error", strTemp0);
}
else
{
SetCtrlVal(hpnlSimpleEthHost, pnlEthHost_numCount, intTemp1);
intTemp1++;
}
}
else
{
SetCtrlVal(hpnlSimpleEthHost, pnlEthHost_numMainDataSize, intNumBytesRecv);
}
}
}
return 0;
}