Still a question:
I have a datablock in the main thread in which the listening_socket is declared and setup.
I pass this datablock to the thread with the accept() blocking call that uses the listening_socket.
Do you think I need to use EnterCriticalSection() before I call closesocket(listening_socket)?
I think the answer: no need. Socket handles in your program refers to internal Winsock kitchen: let Winsocket deals with its sockets...
But you need to invent (or use) some kind of thread synchronization mechanics, of course (to control all your threads execution).
It seems the worst case - accept() in socket thread returns any error code...
Please, carefully test my suggestion before use. It seems it's not so hard test case emulate this forced disconnection. Now I can't do it, sorry...
Good luck!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.