I am playing aroung with a multi threaded app and sockets and have the following situation...
I have a AsyncSocket in which I override OnAccept.
CConnectionThread *pConnection = new CConnectionThread();
// Exit the thread
CString strMessage = "Welcome...\n";
where CConnectionThread is derived from CWinThread and m_cSocket is a CAsyncSocket member variable in CConnectionThread
The above works fine. All incoming connection request spawns this CConnectionThread and I receive the Welcome message
My problem is now that I can't seem to get these threads to exit in any way. I have tried calling ExitThread and _endthread, but they close the "listening thread" instead of the newly created client thread. I have tried delete(pConnection), but although it destroys the class, the thread still remains active. I have tried CloseHandle and other less applicaple options, nothing seems to work. The thread never closes.
Does anybody have an idea of how I can close (kill) the connection thread?