You have not indicated how the CSocket was created. There are two considerations here:
First, forget CSocket exists. It is the worst possible way to write networking code, it is
an unreliable method of doing network communication. And it has been reported that the MFC
implementation of CSocket has bugs. So you should always use CAsyncSocket.
Second, you have not said anything about how this CSocket gets created and opened. The
implication of your question is that it has already been opened, presumably in the main
thread. In that case, the main thread is handling the traffic, so the fact that there is a
object of type CSocket contained in a CWinThread object is pretty irrelevant. Just because
the object is stored in some random memory location such as inside a CWinThread does not
affect its behavior if it already belongs to some other thread. You cannot pass a
C[Async]Socket across thread boundaries, and consequently you need to pass the raw SOCKET
object across the boundary. To do this, see my essay on UI threads on my MVP Tips site,
which discusses how to create a socket in one thread and pass it across to another thread.
What it means is that you probably have a CSocket owned by the main GUI thread, so the
state of the UI thread is absolutely irrelevant to the CSocket or its behavior.
joe
On 7 Jul 2005 18:19:37 -0700,
ckkwan@my-deja.com (Kwan) wrote:
Quote
Hi All,
I have created a UI Thread with a CSocket object inside.
The thread was created with SUSPENDED state.
But the Socket is still able to receive incoming request even when I
didn't ResumeThread.
When I resume the thread later, the state return is '1', that shows it
was indeed suspended.
So, my question is, when a UI thread is suspended, is it mean the
message pump still running?
Joseph M. Newcomer [MVP]
email:
newcomer@flounder.com
Web:
www.flounder.com">
www.flounder.com
MVP Tips:
www.flounder.com/mvp_tips.htm">
www.flounder.com/mvp_tips.htm
-