> - Shutdown is as follows: > - the PID is noted > - Socket.shutdown(1); > - Socket.processMessages; > > -> one never gets into OnSessionClosed. Why?
Because the message pump is not properly called. ProcessMessages is not equivalent to the message loop. It just process messages already in the queue and then returns. Since closing take some times, the FD_CLOSE message is not yet in the queue while ProcessMessages has returned. You should simply not exit the MessageLoop before the socket is closed. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be ----- Original Message ----- From: "Humm, Markus" <[EMAIL PROTECTED]> To: "ICS support mailing" <twsocket@elists.org> Sent: Friday, February 03, 2006 2:06 PM Subject: [twsocket] Problems with TWSocket.close and DLL > Hello, > > sorry, pressed the wrong button. > > I had changed the code now so that the socket is created within the > context of the thread > (veryfied by GetCurrentThreadID) at start of execute and closing is > initiated at the end of > execute (same threadID). In the communication DLL (not the one which > contains the thread but > the one who makes all ICS calls) I have output the ThreadID as well in the > line before that > shutdown call. It is all the same threadID, but he doesn't reach > OnSessionClosed! > Neither the output file it would create nor a breakpoint set on it is > reached! > > Before lunch I had 2 time succes, but now the app. hangs again with no > obvious reason! > What can this be... > > It's like this now: > > - communication dll sets up one dedicated socket for receiving data > - communication dll sets up a thread for message polling for the other > components > - the packet handling dll creates a thread > - the packet handling dll initiates a socket connection within the execute > method of that created thread > - the PID of the thread is noted > - some data is sen via this connection (works) > - some data is received via the dedicated connection (works) > - the packet handling dll terminates the tread and initiates the close of > the socket connection > it created via. > > - Shutdown is as follows: > - the PID is noted > - Socket.shutdown(1); > - Socket.processMessages; > > -> one never gets into OnSessionClosed. Why? > > Greetings > > 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 -- 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