Hello Jack,

> But it could be SendMessageA called by

Yes possible.

Jack can you try to make a simple new project to demonstrate the
behaviour ? I will be glad to try debug in it.

Wich delphi version do you use ?

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Saturday, March 4, 2006, 19:54, Jack wrote:

> Hello Wilfried,

> It looks like it. But it could be SendMessageA called by
> WSACleanup, which waits until SendMessageA message is processed.
> Maybe this is because the target window and winproc has
> been destroyed by TCustomWSocket.Destroy?

> -- 
> Best regards,
> Jack

> Saturday, March 4, 2006, 10:24:04 AM, you wrote:

>> Hello Jack,

>> I'm checking the log again in your first mail:

>> main thread ($728):
>> 7c90eb94 +0000 ntdll.dll                          KiFastSystemCallRet
>> 77d5f3de +0044 user32.dll                         SendMessageA
>> 71ab8cc3 +489b WS2_32.dll                         WSACleanup
>> 0048cdc4 +0018 Test.exe     WSocket      1789  +2 
>> WSocket_Synchronized_WSACleanup
>> 0048d5d9 +0035 Test.exe     WSocket      2221 +12 WSocketUnloadWinsock
>> 0048e2d7 +007f Test.exe     WSocket      3507 +16 TCustomWSocket.Destroy
>> 00493877 +0037 Test.exe     WSocket      6378  +6 TCustomLineWSocket.Destroy
>> 00494c0e +0092 Test.exe     WSocketS      278 +15 
>> TCustomWSocketServer.Destroy
>> 00402e60 +0008 Test.exe     System                TObject.Free
>> 00454be4 +0008 Test.exe     SysUtils              FreeAndNil
>> 0049e2ad +0031 Test.exe     fTest         213  +5 TFrmTest.CleanUp
>> 0049e148 +004c Test.exe     fTest         133 +15 TFrmTest.FormClose

>> It seems that all is destroyed and that there is something 'hanging' in
>> ntdll.dll. Is this right conclusion because I dont know the MadExcept ?

>> ---
>> Rgds, Wilfried [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> http://www.mestdagh.biz

>> Saturday, March 4, 2006, 18:31, Jack wrote:

>>> Hello Wilfried,

>>> Thanks for the quick reply. No, I don't have a OnSessionClose or
>>> OnChangeState handler. Destroying the server object will abort the
>>> socket? Anyway, I also removed Abort() but the problem is still
>>> happening from time to time as before.

>>> -- 
>>> Best regards,
>>> Jack

>>> Saturday, March 4, 2006, 1:21:05 AM, you wrote:

>>>> Hello Jack,

>>>> I read your mail better now :) No need for Abort. Just Free the
>>>> component. Then OnSessionClose will not fire. What will fire is
>>>> OnChangeState, so be aware if you do things there like updating GUI or
>>>> so.

>>>> ---
>>>> Rgds, Wilfried [TeamICS]
>>>> http://www.overbyte.be/eng/overbyte/teamics.html
>>>> http://www.mestdagh.biz

>>>> Saturday, March 4, 2006, 09:33, Jack wrote:

>>>>> My application halts when WSocketServer is freed, not every time
>>>>> though. But it happens once in a few times when the application is
>>>>> closed. Here's the code snippet:

>>>>>   if WSocketServer <> nil then
>>>>>   begin
>>>>>     WSocketServer.Abort();
>>>>>     Log('Server closed');
>>>>>     FreeAndNil(WSocketServer);
>>>>>     Log('Server freed');
>>>>>   end;

>>>>> When this happens, the last message I get is 'Server closed' so
>>>>> it dies in FreeAndNil(WSocketServer); Log() just add a line in
>>>>> a TMemo. They were added after this problem was seen.

>>>>> I enabled "Check for frozen main thread" in madexcept and got
>>>>> this report:

>>>>> main thread ($728):
>>>>> 7c90eb94 +0000 ntdll.dll                          KiFastSystemCallRet
>>>>> 77d5f3de +0044 user32.dll                         SendMessageA
>>>>> 71ab8cc3 +489b WS2_32.dll                         WSACleanup
>>>>> 0048cdc4 +0018 Test.exe     WSocket      1789  +2
>>>>> WSocket_Synchronized_WSACleanup
>>>>> 0048d5d9 +0035 Test.exe     WSocket      2221 +12 WSocketUnloadWinsock
>>>>> 0048e2d7 +007f Test.exe     WSocket      3507 +16 TCustomWSocket.Destroy
>>>>> 00493877 +0037 Test.exe     WSocket      6378  +6 
>>>>> TCustomLineWSocket.Destroy
>>>>> 00494c0e +0092 Test.exe     WSocketS      278 +15 
>>>>> TCustomWSocketServer.Destroy
>>>>> 00402e60 +0008 Test.exe     System                TObject.Free
>>>>> 00454be4 +0008 Test.exe     SysUtils              FreeAndNil
>>>>> 0049e2ad +0031 Test.exe     fTest         213  +5 TFrmTest.CleanUp
>>>>> 0049e148 +004c Test.exe     fTest         133 +15 TFrmTest.FormClose


>>>>> disassembling:
>>>>> [...]
>>>>> 0048cdac 1787   cmp     dword ptr [$4a5a14], 0
>>>>> 0048cdb3        jnz     loc_48cdc4
>>>>> 0048cdb5 1788   mov     eax, $48cdd4           ; 'WSACleanup'
>>>>> 0048cdba        call    +$979 ($48d738)        ; WSocket.WSocketGetProc
>>>>> 0048cdbf        mov     [$4a5a14], eax
>>>>> 0048cdc4 1789 = call    dword ptr [$4a5a14]    ;
>>>>> 0048cdc4 1789   WSACleanup (WS2_32.dll)
>>>>> 0048cdca 1790   ret


>>>>> Anything I'm doing wrong?





-- 
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

Reply via email to