0

There are sockets in IOCP ..group A,B

A,B are working for receiving data. But when I close sockets in group A like below.

shutdown... closesocket...

Sockets in group B seems like corrupted and stopped working. If anyone has experienced similar symptom. Give me some advice.

Mark Yang
  • 226
  • 3
  • 16

1 Answers1

0

I solved my problem. Problem is worker threads terminated unintentionally. My previous code like below

while (GetQuededCompletionStatus...)
{
    // Do io related works
}

Problem is 'GetQueuedCompiletionStatus' function returns IO status TRUE/FALSE When socket closed It returns FALSE. So entire while loop exited and thread closed. This fixed like below

while (1)
{
   BOOL iostatus = GetQueuedCompletionStatus...
   if (iostatus==TRUE)
   {
       // Do IO works
   }
}

Maybe this skeleton is basic IOCP worker thread loop

Mark Yang
  • 226
  • 3
  • 16