> > > And the socket has been _created in method execute as well? > > > How do you achieve that client sockets run in the client thread > > > if not using ThreadAttach/ThreadDetach?
> > Hm, no it is created before execute. And no thread attach/detach is used. > > It works so far until the point when I try to close it. > This means you don't need a thread for your socket. > Since you have not created the component in the thread's context and you have > not attached it, you > thread is _not_ used for the component event. It is the thread having created > the component which > handle the component events, unless you use ThreadAttach. > Of course, your program is likely to crash because doing as you have done, > you have two threads > simultaneously refering to the same component. You must be sure to use > critical sections and the > likes to protect everything shared between your threads. > Probably the problem you experience when closing the socket is a result of > this thread mess ! These sockets mentioned by me are for sending only. Receiving is done by one central socket for all connections, which works because traffic etc. is not a problem. Okay some of that things are this way because I didn't understand all concepts when initially building this DLL, but I didn't have much time back then. The question is, how should the DLL sitting on top of my communication dll use thread attach? It has no access to the socket whatever, it only has init_communication, close_communication and send. All work with a handle (integer) the communication dlls assigns a new connection within init_connection. How can I solve my problem? Which thread does the socket belon to now? Does it belong to the thread in the dll sitting on top of my communication dll? If yes, why does closing that socket within the execute method of this thread problems? Is it because the socket might have been created by that dll but within another context? If created from the same thread and destroyed by the same thread there would be no problem? Greetings from a puzzled Markus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be