CAsyncSocket and ThreadPool problem

Posted by zabulus on Stack Overflow See other posts from Stack Overflow or by zabulus
Published on 2010-04-18T09:09:50Z Indexed on 2010/04/18 9:13 UTC
Read the original article Hit count: 304

Filed under:
|
|
|
|

I have a server application with such structure: There is one object, call him Server, that in endless cycle listens and accepts connections. I have descendant class from CAsyncSocket, that has overriden event OnReceive, call him ProxySocket. Also I have a thread pool with early created threads.

When connection is received by server object he accepts the new connection on the new object ProxySocket. When data arrives to the ProxySocket, he creates a command object and gives it to thread pool. In this command object I giving the socket handle of a ProxySocket. When new object of command is creating - I creating a new Socket in working thread and attach handle to it.
My issue is next: When command ends, socket doesn't close, I just detach handle it and set CSocket handle to INVALID_SOCKET value, as planned. But my first ProxySocket object doesn't receives messages of new data receiving after that. How can I solve this?

© Stack Overflow or respective owner

Related posts about c++

Related posts about mfc