Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Aug : Re: Application becomes unresponsive when encoding/sending encoding an email.

www.cryer.info
Managed Newsgroup Archive

Re: Application becomes unresponsive when encoding/sending encoding an email.

Subject:Re: Application becomes unresponsive when encoding/sending encoding an email.
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Thu, 17 Aug 2006 10:18:13

"Cornie" <cornievs@gmail.com> wrote in message
news:44e490c5$1@newsgroups.borland.com...

> I am sending  e-mail using an GMail Account, using TIdSMTP,
> TIdSSLIOHandlerSocketOpenSLL and everything works fine,
> except the application because completely unresponsive while it
> is encoding/sending the attachments (Total size of attachments 2 -200 kb).

Are you using the TIdSMTP in the context of the main thread?  If so, then
what you describe is normal, since Indy is a blocking library.  You are
blocking the main message queue from processing new messages while the
message is being sent.  Either drop a TIdAntiFreeze onto the form (not
really recommended), or move the TIdSMTP to a worker thread (recommended).

> I have TIdSMTP.OnStatus event handler that updates a statusbar.
> Once the "AStatusText" change to 'Encoding attachments' the
> application because unresponsive until the message was sended.

Encoding attachments is a lengthy operation in general.  There are no status
messages issued during that time.

> My onwork event is ignore

I seriously doubt that.

> even a timer that updates a counter every 250ms is never called during
this time.

TTimer is a message-based timer.  If the message queue is blocked, the
OnTimer event cannot be triggered.

> I use BDS 2006 and Indy 10.0.52.

> I have put a TIdAntiFreeze on the form, but it did made any differences.

Then you likely did not use it correctly.

>   What is job of AntiFreeze?

To process pending messages from the main message queue during blocking
socket operations.

> I believe this issue is related to Darryl issue "Indy 10 and Encoding
> Email Attachments are very slow" because no feedback is possible
> during the encoding/sending phase.

Yes, it is possible.  Simply move your code into a worker thread so that you
are not blocking the main thread anymore.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive