Which async methods trigger DONE ? (wodSmtp)
by LOGO Datensysteme, Friday, June 02, 2006, 11:42 (6749 days ago)
Hello again,
which of the wodSMTP methods trigger the
DONE event when done in non-blocking mode?
I know of .SendMessage (and all other .Send***)
.Disconnect does not trigger Done (at least not on my tests)
Are there any other methods that triggering Done when actually done?
Best regards
Michael
Re: Which async methods trigger DONE ?
by wodAlan, Friday, June 02, 2006, 12:31 (6749 days ago) @ LOGO Datensysteme
Michael,
Yes, that's correct, all Send Methods trigger Done Event.
And about Disconnect Method, when you disconnect Disconnected Event will be fired, but Done Event should be also fired. I tried with sample which comes in installation package (1.Simple) and Done Event was fired too. Can you try that?
No other Methods triggers Done Event.
Regards,
Alan
Re: Which async methods trigger DONE ?
by LOGO Datensysteme, Friday, June 02, 2006, 14:13 (6749 days ago) @ wodAlan
Hi,
well... The .done-Event (not the notified -method, but the original OCX-exposed .done-Event) does not trigger when i follow this scenario:
- large email with huge attachment (so have plenty of time to react)
- starting transmission with .sendmessage
- everything runs fine, .progress fires and sets my progressbar pretty nicely...
- Now User decides to kill the sending and abort -Button is clicked
- the clickcode of the cmdbutton calls wodsmtp.disconnect() to kill it
- wodSMTP quits transmitting, .state is reset to 0, everything is well
...but: The .done-event did not trigger.
I have a simple messagebox( i am done )-call in the ocx-exposed .done-event, so i can easily see if it is really triggered.
The .done event triggers correctly if i let the transmissing end on its own without interrupting.
[code]
*!* VFP8.0 SP1 -> .DONE event in an wodsmtp.ocx on a simpleform
LPARAMETERS errorcode, errortext
=MESSAGEBOX( I am done )
IF not(EMPTY(errortext))
=MESSAGEBOX(errortext)
ENDIF
thisform.Closable=.T.
thisform.progress.Visible=.F.
[/code]
You see there is nothing spectacular in the method... [:uhoh:]
...but a disconnect.done won't show up, as a sendmessage.done comes up pretty well.
It's not hurting me so much, but if the ocx is still active disconnecting and i am already starting to release the form (containing the ocx) VFP will sure smell desaster.
Best regards
Michael
Re: Which async methods trigger DONE ?
by wodAlan, Friday, June 02, 2006, 15:41 (6749 days ago) @ LOGO Datensysteme
Michael,
Well....yes, I agree with this scenario, but look at this scenario:
1. Sending MSG
2. Message sent (Done Event fired)
3. Disconnect (Disconnected Event and Done Event)
In this case I think it has sense, but in your case what is actually DONE ?
I mean, is something DONE besides Disconnecting?
I think not, and in this case only Disconnected Event fired.
And what about Disconnected Event? In your case, do we even need it?
Every time when we disconnected from server we will fired Done Event and Disconnected Event, and in this case we don't need Disconnected Event, right?
Regards,
Alan
Re: Which async methods trigger DONE ?
by LOGO Datensysteme, Friday, June 02, 2006, 16:57 (6749 days ago) @ wodAlan
Hi Alan,
i totally agree with you as it works perfectly fine at the moment
(as my mailserver is fast and stable)...
I was simply afraid of killing an ocx right in the middle of something (by removing the form which instantiated the ocx initially from memory). VFP simply answers such a doing by crashing completely.
I just don't know what disconnecting actually mean.
Does it mean wodSMTP is telling the Server i am gone and that's it, or would wodSMTP waiting on somekind of answer from the MXserver to its wish to disconnect.
In the later case wodSMTP could take some time to disconnect and i cannot simply release the form directly after the call for .disconnect because there's a great risk of appcrash with this.
You see, if you are telling me it totally ok with wodSMTP to be release right after .disconnect is called, then it's perfectly fine with me, otherwise there is now way to know when .disconnect is actually done (without looping and waiting for .state=0).
Thanks for your patience with me [:smile:]
Best regards
Michael
Re: Which async methods trigger DONE ?
by wodDrazen, Friday, June 02, 2006, 17:23 (6749 days ago) @ LOGO Datensysteme
Hi Michael,
I think best explanation for Disconnect Method and Disconnected Event is given in wodSMTP Help file.
Here is explanation for Disconnect Method:
http://www.weonlydo.com/Smtp/Help/WODSMTPLib~wodSmtp~Disconnect.html
and for Disconnected Event:
http://www.weonlydo.com/Smtp/Help/WODSMTPLib~wodSmtp~Disconnected_EV.html
If you call Disconnect Method, that means that wodSMTP will stop any ongoing deliver and disconnect immediately from the server.
Hope this helps.
Regards,
Drazen
Re: Which async methods trigger DONE ?
by LOGO Datensysteme, Tuesday, June 06, 2006, 09:49 (6745 days ago) @ wodDrazen
Hi Drazen,
I've read the helpfile and disconnect immediately is exactly what i intend to do and my question is not answered in the helpfile. Sorry.
As i am not familiar with the smtp-protocol i was just asking what wodsmtp is doing from the moment on when i issue the disconnect call in terms of the dialog with the connected server.
Is wodSMTP
a.) just closing the connection ignoring any traffic just going on
or
b.) doing some final two-way-conversation with the connected server
In case b.) i have to know if there could be a scenario where the immediate disconnect can fail or be postponed for later by wodSMTP, because where are talking asyncron here which means if i am trying to release wodSMTP from memory directly after calling disconnect i am trashing memory and with it my app. So this general issue is very important and not just me being stubborn [:sad:]
Plain an simple: I cannot see any good reason why in non-blocking mode disconnect shoult not trigger the done effect. It's more coherent with non-blocking mode and simpler to programm with, because then DONE is always (!) triggered whenever wodSMTP is really done with anything it is doing with/to the outside world .
So could you please explain what wodSMTP is doing exactly when i call disconnect?
Thanks for being patient with me [:wink:]
Best regards
Michael
Re: Which async methods trigger DONE ?
by wodSupport, Tuesday, June 06, 2006, 12:52 (6745 days ago) @ LOGO Datensysteme
Michael,
let me hop in and quickly answer.
When you call Disconnect method - connection drops immediatelu without any further data exchange. Socket is just closed.
Hope this helps.
Kreso
Re: Which async methods trigger DONE ?
by LOGO Datensysteme, Tuesday, June 06, 2006, 13:51 (6745 days ago) @ wodSupport
Hi Krezo,
thanks alot. That's all i need to know.
So i will happily remove the form from memory without further hesitation. Sorry for being so insisting, but the memory leak
would have been too big to ignore [:happy:]
Thanks alot to all of you.
Prepare for a neat little sample form in VFP8 SP2 for wodSTMP
soon in one of your mailboxes [:cool:]
Best regards
Michael