> Because it's looks like a serious bug. Then you have a serious opportunity to dig into the component code :-) Seriously, don't use OnSessionClosed to start a new SMTP session (subject of your message). Use OnrequestDone to do almost everything !
-- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be ----- Original Message ----- From: "Max Terentiev" <[EMAIL PROTECTED]> To: "ICS support mailing" <twsocket@elists.org> Sent: Sunday, July 30, 2006 5:17 PM Subject: Re: [twsocket] Best event to start new Smtp session > Hello Francois, > > I don't use Application->ProcessMessages in entire application. > > If event OnSessionClose may trigger (or may not trigger) > twice maybe these checks should be implemented inside SmtpCli component ? > Because it's looks like a serious bug. > > --- > With best regards, Max Terentiev. > Business Software Products. > AMS Development Team. > [EMAIL PROTECTED] > > > ----- Original Message ----- > From: "Francois PIETTE" <[EMAIL PROTECTED]> > To: "ICS support mailing" <twsocket@elists.org> > Sent: Sunday, July 30, 2006 6:24 PM > Subject: Re: [twsocket] Best event to start new Smtp session > > >>> Please tell me: HOW i can be 100% sure that Connection is closed, >>> Component >>> is ready and i can start new Session ? How to avoid wrong OnSessionClose >>> ? >> >> You either have a look at the component source code and try to understand >> why there are two OnSessionClosed events, or you use a flag to remember >> you >> already received OnSessionClosed and have to ignore the second one. >> >> Note that strange event ordering are frequently resulting from calling >> the >> message pump directly or indirectly from one of the events. And indirect >> message pump call occur in each modal window (frequently used to display >> values when debugging: don't do that). >> >> -- >> Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html >> -- >> [EMAIL PROTECTED] >> http://www.overbyte.be >> >> >> >> ----- Original Message ----- >> From: "Max Terentiev" <[EMAIL PROTECTED]> >> To: "ICS support mailing" <twsocket@elists.org> >> Sent: Sunday, July 30, 2006 3:27 PM >> Subject: Re: [twsocket] Best event to start new Smtp session >> >> >>> Hello Wilfred, >>> >>> I try to post message inside OnSessionClosed... >>> But I notice another problem: >>> >>> I don't know why but OnSessionClosed called twice in some cases ! >>> >>> This is a log of my Smtp session where you can see SmtpCli bug: >>> >>> Here is first session, it's sucessfully completed: >>> ----------------- >>> Checking address: [EMAIL PROTECTED] >>> MX Resolved from cache >>> Connectng to 192.168.0.2 >>> 220 Welcome to the mail server for mysite.com Sun, 30 Jul 2006 16:26:14 >>> 0400 >>> 250 mail.mail.ru Hello 192.168.0.1 >>> 250 Current mail transaction reset >>> 250 , sender ok >>> 250 <[EMAIL PROTECTED]> >>> E-Mail Check Result OK >>> Call Smtp->Abort(); >>>>>>Inside OnSessionClosed, Call PostMessage<<< >>> Posted Message Received by my WndProc handler, start checking next >>> address >>> >>> ----------------- >>> Checking address: [EMAIL PROTECTED] >>> Host Resolved from cache >>> Connectng to 192.168.0.2 >>>>>>Inside OnSessionClosed, Call PostMessage<<<<< >>> ^^^^BUG - WHY IT'S TRIGGERED HERE ???^^^ >>> 220 Welcome to the mail server for mysite.com Sun, 30 Jul 2006 16:26:14 >>> 0400 >>> Posted Message Received by my WndProc handler, start checking next >>> address >>> ^^^^^^ It's wrong because wrong OnSessionClosed received ! >>> ----------------- >>> >>> As you can see OnSessionClosed triggered twice ! And from this >>> point program works incorrectly ! >>> >>> Note: it's happens rarely. Program may check up to 10 000 emails before >>> it's happens. It's happens on random place. >>> >>> Please tell me: HOW i can be 100% sure that Connection is closed, >>> Component >>> is ready and i can start new Session ? How to avoid wrong OnSessionClose >>> ? >>> >>> --- >>> With best regards, Max Terentiev. >>> Business Software Products. >>> AMS Development Team. >>> [EMAIL PROTECTED] >>> >>> >>> ----- Original Message ----- >>> From: "Wilfried Mestdagh" <[EMAIL PROTECTED]> >>> To: "ICS support mailing" <twsocket@elists.org> >>> Sent: Sunday, July 30, 2006 12:19 PM >>> Subject: Re: [twsocket] Best event to start new Smtp session >>> >>> >>>> Hello Max, >>>> >>>> it has been a while I worked with TSmtpCli. Try to post a message from >>>> OnSessionClosed to custom message handler. The message hander take car >>>> of next connection. >>>> >>>> --- >>>> Rgds, Wilfried [TeamICS] >>>> http://www.overbyte.be/eng/overbyte/teamics.html >>>> http://www.mestdagh.biz >>>> >>>> Saturday, July 29, 2006, 15:06, Max Terentiev wrote: >>>> >>>>> Hello Wilfred, >>>> >>>>> But how I can detect that SmtpCli->Abort() is finished, component is >>>>> ready and I can call SmtpCli->Connect again for next message ? >>>> >>>> If I call SmtpCli->>Connect() IMMEDIATELY after SmtpCli->Abort() >>>>> I should receive "Component Not Ready" error, right ? >>>> >>>> If SmtpCli->>Abort() is called only OnSessionClose event is triggered >>>>> (OnRequestDone NOT triggered in this case). >>>> >>>>> So, to start new sessuion I must use OnSessionClose in case of Smtp >>>>> protocol >>>>> error/Abort and OnRequestDone in case of successfull sending (no >>>>> Abort) >>>>> ? >>>> >>>>> --- >>>>> With best regards, Max Terentiev. >>>>> Business Software Products. >>>>> AMS Development Team. >>>>> [EMAIL PROTECTED] >>>> >>>> >>>>> ----- Original Message ----- >>>>> From: "Wilfried Mestdagh" <[EMAIL PROTECTED]> >>>>> To: "ICS support mailing" <twsocket@elists.org> >>>>> Sent: Saturday, July 29, 2006 2:04 PM >>>>> Subject: Re: [twsocket] Best event to start new Smtp session >>>> >>>> >>>>>> Hello Max, >>>>>> >>>>>> Use OnRequestDone to trigger next sending, not OnStateChange or >>>>>> OnSessionClosed. Both latter are more for log or display updates. >>>>>> >>>>>> --- >>>>>> Rgds, Wilfried [TeamICS] >>>>>> http://www.overbyte.be/eng/overbyte/teamics.html >>>>>> http://www.mestdagh.biz >>>>>> >>>>>> Saturday, July 29, 2006, 11:48, Max Terentiev wrote: >>>>>> >>>>>>> Helo, >>>>>> >>>>>>> What is a best event for starting new Smtp session (e.g. >>>>>>> start sending next message after previous is sent or aborted)? >>>>>> >>>>>>> I was try to Use OnSessionClosed or OnStateChange events >>>>>>> (in OnStateChange i wait for SmtpCli->State==smtpReady and >>>>>> Smtp->>CtrlSocket->State=wsClosed). >>>>>> >>>>>>> But anyway i receive folowing errors time to time: >>>>>> >>>>>>> 1. Smtp component not ready >>>>>>> 2. Error in function WSACancelAsyncRequest - Invalid Argument >>>>>>> 3. Smtp component already connected >>>>>>> 4. Can't change socks port if not closed. >>>>>> >>>>>>> This errors happens time to time (program can work minutes or hours >>>>>>> before >>>>>>> it). >>>>>> >>>>>>> I not understand why it's happens ? >>>>>> >>>>>>> After sending message (or getting smtp protocol error during sending >>>>>>> message) I ALWAYS Call SmtpCli->Abort() and wait in OnStateChange >>>>>>> until connection closed and component is ready. After it I prepare >>>>>>> next >>>>>>> message and call SmtpCli->Connect(), etc. >>>>>> >>>>>>> Why I receive errors 1-4 ?? Maybe I must do something special ? How >>>>>>> i >>>>>>> can ensure what connection is 100% closed and component 100% ready >>>>>>> for >>>>>>> next >>>>>>> session ? >>>>>> >>>>>>> I NOT use Application->ProcessMessages inside SmtpCli events. >>>>>> >>>>>>> Please help... And excuse me for bad english. >>>>>> >>>>>>> --- >>>>>>> With best regards, Max Terentiev. >>>>>>> Business Software Products. >>>>>>> AMS Development Team. >>>>>>> [EMAIL PROTECTED] >>>>>> >>>>>> >>>>>> -- >>>>>> 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 >>>> >>> >>> -- >>> 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 >> > > -- > 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