[twsocket] Freeze when using smtp after recreating its parent form
Hi! I have probably misunderstood something because I get the same behavior described below no matter which of the components SmtpCli, SyncSmtpCli and HtmlSmtpCli I use. The problem has to do with freeing the smtp-components parent form. You can easily duplicate the behavior with one of the standard demo applications: * Open Your favorite demo of MailSnd, MimeTst or MailHtml. (I proceed with MailSnd-demo below.) * Add a new form with a button to the project. Write the following in the buttons OnClick method: procedure TForm2.Button1Click(Sender: TObject); begin SmtpTestForm := TSmtpTestForm.Create(Application); try SmtpTestForm.ShowModal; finally SmtpTestForm.Release; end; end; * Click on the menu: Project - Options, and remove the SmtpTestFrom from the Auto-createForms list. * Run the application and click the button. SmtpTestForm opens and You can send lots of e-mails. * Close SmtpTestForm and press the button again. Try to send yet another email and You get stuck! I guess I'm doing something fundamentally wrong?! I have narrowed it down to that everything works as expected if I don't release the form. (I get the same error when setting Action to caFree in SmtpTestFrom.OnClose.) Is it not a good idea to free a manually created form? Best Regards Henrik -- 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
Re: [twsocket] Freeze when using smtp after recreating its parent form
- Original Message - From: Henrik [EMAIL PROTECTED] To: twsocket@elists.org Sent: Monday, December 11, 2006 9:59 AM Subject: [twsocket] Freeze when using smtp after recreating its parent form Hi! I have probably misunderstood something because I get the same behavior described below no matter which of the components SmtpCli, SyncSmtpCli and HtmlSmtpCli I use. The problem has to do with freeing the smtp-components parent form. You can easily duplicate the behavior with one of the standard demo applications: * Open Your favorite demo of MailSnd, MimeTst or MailHtml. (I proceed with MailSnd-demo below.) * Add a new form with a button to the project. Write the following in the buttons OnClick method: procedure TForm2.Button1Click(Sender: TObject); begin SmtpTestForm := TSmtpTestForm.Create(Application); try SmtpTestForm.ShowModal; finally SmtpTestForm.Release; end; end; When entering the second time is the form already released then? I normally just call .free never used .released. I also make the SmtpTestForm a procedure based variable in these kind of constructions. -- 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
Re: [twsocket] Freeze when using smtp after recreating its parentform
I normally just call .free never used .released. You have to use Release when called from an event handler which originate from the form you are freeing. Release make sure all curent events are processed. Free does an immediate free which will crash the application if one event handler is still running. Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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
Re: [twsocket] Freeze when using smtp after recreating itsparentform
I normally just call .free never used .released. You have to use Release when called from an event handler which originate from the form you are freeing. Release make sure all curent events are processed. Free does an immediate free which will crash the application if one event handler is still running. But that was not the case with this code, there was just a showmodal -- 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
Re: [twsocket] Freeze when using smtp after recreating its parentform
Hi Frans! Yes, each time You press the button the form is created and then released. You also get the same problem if You set Action to caFree in the OnClose of the created form. procedure TForm2.Button1Click(Sender: TObject); begin SmtpTestForm := TSmtpTestForm.Create(Application); SmtpTestForm.ShowModal; end; procedure TSmtpTestForm.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; end; Also read my response to Arno. I'm very thankful for all the help I can get! // Henrik -Ursprungligt meddelande- Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För Frans van Daalen Skickat: den 11 december 2006 10:39 Till: ICS support mailing Ämne: Re: [twsocket] Freeze when using smtp after recreating its parentform - Original Message - From: Henrik [EMAIL PROTECTED] To: twsocket@elists.org Sent: Monday, December 11, 2006 9:59 AM Subject: [twsocket] Freeze when using smtp after recreating its parent form Hi! I have probably misunderstood something because I get the same behavior described below no matter which of the components SmtpCli, SyncSmtpCli and HtmlSmtpCli I use. The problem has to do with freeing the smtp-components parent form. You can easily duplicate the behavior with one of the standard demo applications: * Open Your favorite demo of MailSnd, MimeTst or MailHtml. (I proceed with MailSnd-demo below.) * Add a new form with a button to the project. Write the following in the buttons OnClick method: procedure TForm2.Button1Click(Sender: TObject); begin SmtpTestForm := TSmtpTestForm.Create(Application); try SmtpTestForm.ShowModal; finally SmtpTestForm.Release; end; end; When entering the second time is the form already released then? I normally just call .free never used .released. I also make the SmtpTestForm a procedure based variable in these kind of constructions. -- 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
Re: [twsocket] Freeze when using smtp after recreating its parentform
Hi Arno and thank You for the reply! I use V2.32 of SmtpProt.pas (the one You get when clicking Download the latest ICS-V5 Distribution on overbyte.be) and Delphi7. Trying to solve this mystery I have now discovered two things: * Since You did not experience any problem I decided to test the example application on another computer by copying the exe-file. Here the second time I show the SmtpTestForm and presses the All-in-one button everything works ok and the mail is being sent as expected!!! Do You have any ideas on what can be the difference between these computers that leads to the freeze problem on just one of them? (both has Win XP SP2 and the latest Windows update patches) * I don't know if this gives any clues but a workaround on the computer where the problems appear is to either not destroy the form OR create a dummy smtpCli component like in the code below! procedure TForm2.Button1Click(Sender: TObject); var dummySmtpCli : TSmtpCli; alreadyCreated: Boolean; i: integer; begin SmtpTestForm := TSmtpTestForm.Create(Application); // Workaround that prevents freezing on some computers alreadyCreated := false; if Application.ComponentCount 0 then begin for i := 0 to Application.ComponentCount-1 do begin if Application.Components[i].Name = 'DummySmtpClient' then begin alreadyCreated := true; BREAK; end; end; end; if not(alreadyCreated) then begin dummySmtpCli := TSmtpCli.Create(Application); dummySmtpCli.Name := 'DummySmtpClient'; end; try SmtpTestForm.ShowModal; finally SmtpTestForm.Release; end; end; Any further thoughts on the matter is greatly appreciated! // Henrik -Ursprungligt meddelande- Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För Arno Garrels Skickat: den 11 december 2006 10:32 Till: ICS support mailing Ämne: Re: [twsocket] Freeze when using smtp after recreating its parentform Hello Henrik, Just tested with latest V5 beta, but works great? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Henrik wrote: Hi! I have probably misunderstood something because I get the same behavior described below no matter which of the components SmtpCli, SyncSmtpCli and HtmlSmtpCli I use. The problem has to do with freeing the smtp-components parent form. You can easily duplicate the behavior with one of the standard demo applications: * Open Your favorite demo of MailSnd, MimeTst or MailHtml. (I proceed with MailSnd-demo below.) * Add a new form with a button to the project. Write the following in the buttons OnClick method: procedure TForm2.Button1Click(Sender: TObject); begin SmtpTestForm := TSmtpTestForm.Create(Application); try SmtpTestForm.ShowModal; finally SmtpTestForm.Release; end; end; * Click on the menu: Project - Options, and remove the SmtpTestFrom from the Auto-createForms list. * Run the application and click the button. SmtpTestForm opens and You can send lots of e-mails. * Close SmtpTestForm and press the button again. Try to send yet another email and You get stuck! I guess I'm doing something fundamentally wrong?! I have narrowed it down to that everything works as expected if I don't release the form. (I get the same error when setting Action to caFree in SmtpTestFrom.OnClose.) Is it not a good idea to free a manually created form? Best Regards Henrik -- 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
Re: [twsocket] Freeze when using smtp after recreating itsparentform
Hi Frans! Yes, each time You press the button the form is created and then released. You also get the same problem if You set Action to caFree in the OnClose of the created form. Sorry, for not expressing myself any better. My question was If you run the debug and while entring the buttonclick is the .release finished so did you find the form to be free-ed already and my second remark was If you replace the .release with .free is the problem still there?. My final remark was that I normally have the form as a procedure variable as it is not needed to be defined outside the buttonclick event and maybe that also solves your issue. -- 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
[twsocket] I found some bugs in your ICS (or mine maybe)
Hello ! Your components are really great. But i've faced with some problems out here. I'm trying to make multithreaded FTP list checker. I'm not going to talk a lot, i'll just post code of creating TFTPCli component and using it. Here it is (it is very simple): // [FTP Component initialization] FTP = new TFtpClient(NULL); FTP-Binary = true; FTP-Port = ftp; FTP-Timeout = 15; FTP-ShareMode = ftpShareExclusive; FTP-Passive = true; FTP-MultiThreaded = true; FTP-ConnectionType = ftpDirect; // [/FTP Component initialization] Then in loop do-while im taking information from TListView and binding it to the component (Host, User and Pass). Then i'm starting all that. First 3-4 FTPs are checked very good, but ALMOST all others receive such error: 500 DNS lookup error - Interrupted system call (#10004) I'm totally sure that this is bug of TFTPClient when you trying to use threads, because if i'll check again those FTPs who had such answer - they will work normally (it is somehow related to blocking hooks or sockets, i don't know exactly). Can you please tell, how to fix that out ? P.S.: I've attached to letter my program source code. Maybe that will help you find out the real reason of that. There is very simple code. It was created in Borland C++Builder version 6. With Respect, ProgMaster _ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ -- 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
Re: [twsocket] Freeze when using smtp after recreating itsparentform
Henrik, Hmm, your 'workaround' doesn't sound logical, why should a secondary instance of a _V5_ component have any effects, strange? Do you close the SMTP-form while mail is been sent? Is the SMTP-form yet destroyed when you create another one? When does it freeze exactely (try the buttons on the left, Connect etc. instead)? How is the CPU load when it freezes? What is different with the two boxes, any Anti Virus software, any personal firewall etc.? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Henrik wrote: Hi Arno and thank You for the reply! I use V2.32 of SmtpProt.pas (the one You get when clicking Download the latest ICS-V5 Distribution on overbyte.be) and Delphi7. Trying to solve this mystery I have now discovered two things: * Since You did not experience any problem I decided to test the example application on another computer by copying the exe-file. Here the second time I show the SmtpTestForm and presses the All-in-one button everything works ok and the mail is being sent as expected!!! Do You have any ideas on what can be the difference between these computers that leads to the freeze problem on just one of them? (both has Win XP SP2 and the latest Windows update patches) * I don't know if this gives any clues but a workaround on the computer where the problems appear is to either not destroy the form OR create a dummy smtpCli component like in the code below! procedure TForm2.Button1Click(Sender: TObject); var dummySmtpCli : TSmtpCli; alreadyCreated: Boolean; i: integer; begin SmtpTestForm := TSmtpTestForm.Create(Application); // Workaround that prevents freezing on some computers alreadyCreated := false; if Application.ComponentCount 0 then begin for i := 0 to Application.ComponentCount-1 do begin if Application.Components[i].Name = 'DummySmtpClient' then begin alreadyCreated := true; BREAK; end; end; end; if not(alreadyCreated) then begin dummySmtpCli := TSmtpCli.Create(Application); dummySmtpCli.Name := 'DummySmtpClient'; end; try SmtpTestForm.ShowModal; finally SmtpTestForm.Release; end; end; Any further thoughts on the matter is greatly appreciated! // Henrik -Ursprungligt meddelande- Från: [EMAIL PROTECTED] [mailto:twsocket- [EMAIL PROTECTED] För Arno Garrels Skickat: den 11 december 2006 10:32 Till: ICS support mailing Ämne: Re: [twsocket] Freeze when using smtp after recreating its parentform Hello Henrik, Just tested with latest V5 beta, but works great? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Henrik wrote: Hi! I have probably misunderstood something because I get the same behavior described below no matter which of the components SmtpCli, SyncSmtpCli and HtmlSmtpCli I use. The problem has to do with freeing the smtp-components parent form. You can easily duplicate the behavior with one of the standard demo applications: * Open Your favorite demo of MailSnd, MimeTst or MailHtml. (I proceed with MailSnd-demo below.) * Add a new form with a button to the project. Write the following in the buttons OnClick method: procedure TForm2.Button1Click(Sender: TObject); begin SmtpTestForm := TSmtpTestForm.Create(Application); try SmtpTestForm.ShowModal; finally SmtpTestForm.Release; end; end; * Click on the menu: Project - Options, and remove the SmtpTestFrom from the Auto-createForms list. * Run the application and click the button. SmtpTestForm opens and You can send lots of e-mails. * Close SmtpTestForm and press the button again. Try to send yet another email and You get stuck! I guess I'm doing something fundamentally wrong?! I have narrowed it down to that everything works as expected if I don't release the form. (I get the same error when setting Action to caFree in SmtpTestFrom.OnClose.) Is it not a good idea to free a manually created form? Best Regards Henrik -- 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
Re: [twsocket] I found some bugs in your ICS (or mine maybe)
Hello Aleksey, system call (#10004) I'm totally sure that this is bug of TFTPClient when you trying to use threads, I'm totally sure that this is because you do not use the component correctly. Tell us why you want to use threads, ICS can handle hundreds of concurrent connections easily, each transferring data at the same time, since it uses non-blocking sockets. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Aleksey Potjomkin wrote: Hello ! Your components are really great. But i've faced with some problems out here. I'm trying to make multithreaded FTP list checker. I'm not going to talk a lot, i'll just post code of creating TFTPCli component and using it. Here it is (it is very simple): // [FTP Component initialization] FTP = new TFtpClient(NULL); FTP-Binary = true; FTP-Port = ftp; FTP-Timeout = 15; FTP-ShareMode = ftpShareExclusive; FTP-Passive = true; FTP-MultiThreaded = true; FTP-ConnectionType = ftpDirect; // [/FTP Component initialization] Then in loop do-while im taking information from TListView and binding it to the component (Host, User and Pass). Then i'm starting all that. First 3-4 FTPs are checked very good, but ALMOST all others receive such error:500 DNS lookup error - Interrupted system call (#10004) I'm totally sure that this is bug of TFTPClient when you trying to use threads, because if i'll check again those FTPs who had such answer - they will work normally (it is somehow related to blocking hooks or sockets, i don't know exactly). Can you please tell, how to fix that out ? P.S.: I've attached to letter my program source code. Maybe that will help you find out the real reason of that. There is very simple code. It was created in Borland C++Builder version 6. With Respect, ProgMaster _ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ -- 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
Re: [twsocket] Freeze when using smtp after recreating its parentform
Hi again Frans! Sorry, for not expressing myself any better. No need for excuse, it was probably I who misunderstood You... My question was If you run the debug and while entring the buttonclick is the .release finished so did you find the form to be free-ed already Yes, I think so. (The freezing occurs when trying to connect the second time the SmtpTestForm is created) and my second remark was If you replace the .release with .free is the problem still there?. Yes, it's still there (and also if using Action := caFree in OnClose) My final remark was that I normally have the form as a procedure variable as it is not needed to be defined outside the buttonclick event and maybe that also solves your issue. I don't know if I understand You correctly but I think I'm doing the same; I have a separate email unit in my code library with a single Execute function that takes the necessary e-mail settings as parameters (host, emailaddress and so on), shows a status form and returns true or false depending on if the email was sent or not. This function takes care of everything for me so I can use it to send email from any application just using the Execute function. Best Regards Henrik -- 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
Re: [twsocket] Freeze when using smtp after recreating itsparentform
Hi, Procedure Variable is a variable that has scope only for a given procedure. Example: procedure MyForm.ButtonSendMailClick(Sender : TObject); var MySendMailForm : TMySendMailForm; -- Procedure Variable, for its only accessible inside this procedure (ButtonSendMailClick)... begin MySendMailForm := TMySendMailForm.Create(params..); etc... . end; Regards, Marcelo Grossi My final remark was that I normally have the form as a procedure variable as it is not needed to be defined outside the buttonclick event and maybe that also solves your issue. I don't know if I understand You correctly but I think I'm doing the same; I have a separate email unit in my code library with a single Execute function that takes the necessary e-mail settings as parameters (host, emailaddress and so on), shows a status form and returns true or false depending on if the email was sent or not. This function takes care of everything for me so I can use it to send email from any application just using the Execute function. Best Regards Henrik -- 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
Re: [twsocket] TWSocket Digest, Vol 199, Issue 2
Hello Arno, I'm totally sure that this is because you do not use the component correctly. Tell us why you want to use threads, ICS can handle hundreds of concurrent connections easily, each transferring data at the same time, since it uses non-blocking sockets. 1)I've posted some code in my message, what is there wrong there ? 2) I used threads because i even didn't know that TFTPCli can handle concurrent connections. Sure i would try this method, but can you give me some advices how to use this feature ? Or even maybe some samples ? With Respect, Aleksey Message: 6 Date: Mon, 11 Dec 2006 15:15:09 +0100 From: Arno Garrels [EMAIL PROTECTED] Subject: Re: [twsocket] I found some bugs in your ICS (or mine maybe) To: ICS support mailing twsocket@elists.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=iso-8859-1 Hello Aleksey, system call (#10004) I'm totally sure that this is bug of TFTPClient when you trying to use threads, I'm totally sure that this is because you do not use the component correctly. Tell us why you want to use threads, ICS can handle hundreds of concurrent connections easily, each transferring data at the same time, since it uses non-blocking sockets. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html --- Aleksey Potjomkin _ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ -- 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
Re: [twsocket] TWSocket Digest, Vol 199, Issue 2
Aleksey, 1)I've posted some code in my message, what is there wrong there ? That snippet just assigns some properties so doesn't tell me anything. 2) I used threads because i even didn't know that TFTPCli can handle concurrent connections. Sure i would try this method, but can you give me some advices how to use this feature ? Or even maybe some samples ? You do not need multiple threads for the socket I/O, multiple threads should be used only for blocking, lengthy tasks such as an SQL query or something. To get an first idea of the asychronous (non-blocking) nature of ICS read this first: http://wiki.overbyte.be/wiki/index.php/Asynchronous_Paradigm You may also have a look at the MailSndAsync demo of V5, it's SMTP but the same principle applies to the FTP component. If you have further questions, please post them here. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html With Respect, Aleksey Message: 6 Date: Mon, 11 Dec 2006 15:15:09 +0100 From: Arno Garrels [EMAIL PROTECTED] Subject: Re: [twsocket] I found some bugs in your ICS (or mine maybe) To: ICS support mailing twsocket@elists.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=iso-8859-1 Hello Aleksey, system call (#10004) I'm totally sure that this is bug of TFTPClient when you trying to use threads, I'm totally sure that this is because you do not use the component correctly. Tell us why you want to use threads, ICS can handle hundreds of concurrent connections easily, each transferring data at the same time, since it uses non-blocking sockets. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html --- Aleksey Potjomkin _ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ -- 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
Re: [twsocket] TWSocket Digest, Vol 199, Issue 2
2) I used threads because i even didn't know that TFTPCli can handle concurrent connections. Sure i would try this method, but can you give me some advices how to use this feature ? Or even maybe some samples ? Have a look at FtpAsy sample program (In ICS-V5 but also good for V6 provided you change the uses clause). btw: For your next message, be sure to use a proper subject. Using a proper subject enhance your chances to get an answer. Also note that using non digest mode help user to follow the message threads (messages are linked together and grouped by subject when seen in Outlook). -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] 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