Hello Wilfred!

Yes, I get the same behavior when running the application from within the
IDE. So I traced the code up until the application stops to respond. (And
yes, we mean the same thing: the application freezes or hangs so that You
can't quit and You can not move or close the window.)

The trace disappears in the function WSocket_Synchronized_WSAAsyncSelect in
WSocket.pas. You can see the actual line where something happens in the code
snippet below:

function WSocket_Synchronized_WSAAsyncSelect(
           s: TSocket; HWindow: HWND;
           wMsg: u_int; lEvent: Longint): Integer;
begin
  SaveTrace('Start WSocket.pas: function
WSocket_Synchronized_WSAAsyncSelect');
  
  if @FWSAAsyncSelect = nil then
      @FWSAAsyncSelect := WSocketGetProc('WSAAsyncSelect');

  SaveTrace('Hang on the line below this row: Result :=
FWSAAsyncSelect...');

  Result := FWSAAsyncSelect(s, HWindow, wMsg, lEvent);   // <------
Something happens here

  SaveTrace('Hang on the line obove this row: Result :=
FWSAAsyncSelect...');
  SaveTrace('End   WSocket.pas: function
WSocket_Synchronized_WSAAsyncSelect');
end;

Does this make any sense?
Best Regards 
Henrik



Ps. If there by any chance is someone who want a bit more "in depth facts",
I also attached the following trace logs :-)

I added the SaveTrace procedure seen in the snippet above at the first line
and the last line of the following functions and procedures:
  WSocket.pas:  function XSocketWindowProc
  WSocket.pas:  procedure TCustomWSocket.WndProc
  WSocket.pas:  procedure TCustomWSocket.WMAsyncGetHostByName
  WSocket.pas:  procedure TCustomWSocket.TriggerDNSLookupDone
  SmtpProt.pas: procedure TCustomSmtpClient.WSocketDnsLookupDone
  WSocket.pas:  procedure TCustomSocksWSocket.Connect;
  WSocket.pas:  procedure TCustomWSocket.Connect
  WSocket.pas:  function WSocket_Synchronized_WSAAsyncSelect

So after the ConnectButton in the example is pressed I get the following
results on computers where everything works:

First time the SmtpTestForm is created and ConnectButton is pressed:
--------------------------------------------------------------------
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
  End   WSocket.pas: procedure TCustomWSocket.WndProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
  End   WSocket.pas: procedure TCustomWSocket.WndProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
    Start WSocket.pas: procedure TCustomWSocket.WMAsyncGetHostByName
      Start WSocket.pas: procedure TCustomWSocket.TriggerDNSLookupDone
        Start SmtpProt.pas: procedure TCustomSmtpClient.WSocketDnsLookupDone
          Start WSocket.pas: procedure TCustomSocksWSocket.Connect
            Start WSocket.pas: procedure TCustomWSocket.Connect
              Start WSocket.pas: function
WSocket_Synchronized_WSAAsyncSelect
                Hang on the line below this row: Result :=
FWSAAsyncSelect...
                Hang on the line obove this row: Result :=
FWSAAsyncSelect...
              End   WSocket.pas: function
WSocket_Synchronized_WSAAsyncSelect
            End   WSocket.pas: procedure TCustomWSocket.Connect
        End   SmtpProt.pas: procedure TCustomSmtpClient.WSocketDnsLookupDone
      End   WSocket.pas: procedure TCustomWSocket.TriggerDNSLookupDone
    End   WSocket.pas: procedure TCustomWSocket.WMAsyncGetHostByName
  End   WSocket.pas: procedure TCustomWSocket.WndProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
  End   WSocket.pas: procedure TCustomWSocket.WndProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
  End   WSocket.pas: procedure TCustomWSocket.WndProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
  End   WSocket.pas: procedure TCustomWSocket.WndProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc


I close the SmtpTestForm, release it and create it again.
When ConnectButton is pressed this time I get the following trace:
------------------------------------------------------------------
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
    Start WSocket.pas: procedure TCustomWSocket.WMAsyncGetHostByName
      Start WSocket.pas: procedure TCustomWSocket.TriggerDNSLookupDone
        Start SmtpProt.pas: procedure TCustomSmtpClient.WSocketDnsLookupDone
          Start WSocket.pas: procedure TCustomSocksWSocket.Connect
            Start WSocket.pas: procedure TCustomWSocket.Connect
              Start WSocket.pas: function
WSocket_Synchronized_WSAAsyncSelect
                Hang on the line below this row: Result :=
FWSAAsyncSelect...
                Hang on the line obove this row: Result :=
FWSAAsyncSelect...
              End   WSocket.pas: function
WSocket_Synchronized_WSAAsyncSelect
            End   WSocket.pas: procedure TCustomWSocket.Connect
        End   SmtpProt.pas: procedure TCustomSmtpClient.WSocketDnsLookupDone
      End   WSocket.pas: procedure TCustomWSocket.TriggerDNSLookupDone
    End   WSocket.pas: procedure TCustomWSocket.WMAsyncGetHostByName
  End   WSocket.pas: procedure TCustomWSocket.WndProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
  End   WSocket.pas: procedure TCustomWSocket.WndProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
  End   WSocket.pas: procedure TCustomWSocket.WndProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
  End   WSocket.pas: procedure TCustomWSocket.WndProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc



So now to the interesting part. On computers where the application freezes I
get the following trace.
First time the SmtpTestForm is created and ConnectButton is pressed:
--------------------------------------------------------------------
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
    Start WSocket.pas: procedure TCustomWSocket.WMAsyncGetHostByName
      Start WSocket.pas: procedure TCustomWSocket.TriggerDNSLookupDone
        Start SmtpProt.pas: procedure TCustomSmtpClient.WSocketDnsLookupDone
          Start WSocket.pas: procedure TCustomSocksWSocket.Connect
            Start WSocket.pas: procedure TCustomWSocket.Connect
              Start WSocket.pas: function
WSocket_Synchronized_WSAAsyncSelect
                Hang on the line below this row: Result :=
FWSAAsyncSelect...
                Hang on the line obove this row: Result :=
FWSAAsyncSelect...
              End   WSocket.pas: function
WSocket_Synchronized_WSAAsyncSelect
            End   WSocket.pas: procedure TCustomWSocket.Connect
        End   SmtpProt.pas: procedure TCustomSmtpClient.WSocketDnsLookupDone
      End   WSocket.pas: procedure TCustomWSocket.TriggerDNSLookupDone
    End   WSocket.pas: procedure TCustomWSocket.WMAsyncGetHostByName
  End   WSocket.pas: procedure TCustomWSocket.WndProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
  End   WSocket.pas: procedure TCustomWSocket.WndProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
  End   WSocket.pas: procedure TCustomWSocket.WndProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
  End   WSocket.pas: procedure TCustomWSocket.WndProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc


I close the SmtpTestForm, release it and create it again.
When ConnectButton is pressed this time I get the following trace:
------------------------------------------------------------------
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
End   WSocket.pas: function XSocketWindowProc
Start WSocket.pas: function XSocketWindowProc
  Start WSocket.pas: procedure TCustomWSocket.WndProc
    Start WSocket.pas: procedure TCustomWSocket.WMAsyncGetHostByName
      Start WSocket.pas: procedure TCustomWSocket.TriggerDNSLookupDone
        Start SmtpProt.pas: procedure TCustomSmtpClient.WSocketDnsLookupDone
          Start WSocket.pas: procedure TCustomSocksWSocket.Connect
            Start WSocket.pas: procedure TCustomWSocket.Connect
              Start WSocket.pas: function
WSocket_Synchronized_WSAAsyncSelect
                Hang on the line below this row: Result :=
FWSAAsyncSelect...



 



-----Ursprungligt meddelande-----
Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För
Wilfried Mestdagh
Skickat: den 12 december 2006 13:17
Till: ICS support mailing
Ämne: Re: [twsocket] Freeze when using smtp after recreating its parentform

Hello Henrik,

Do you have the same problem in the IDE ?  Because this way you can check
witch code line never comes back (freeze). If not eventually open a console
window and write some debug information into it to see where it happens.

Your approach is normal. I do this all the time, however I almost never use
forms for it. Normally I have an object containing the component, eg
TSmtpClient, another object that creates / handles / destroy the TSmtpClient
objects. But in principle it is the same. It can as whell be a DataModule, a
Form or whatever other object.

Question: We do understeand the word 'Freeze' the right way ?  Form cannot
moved, closed, application cannot quit, etc... Right ?

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


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