Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Mar : Delphi7.Indy10.0.52.POP3 component loosing connectvity to the server while getti

www.cryer.info
Managed Newsgroup Archive

Delphi7.Indy10.0.52.POP3 component loosing connectvity to the server while getti

Subject:Delphi7.Indy10.0.52.POP3 component loosing connectvity to the server while getti
Posted by:"ilya ovsishcher" (iomong..@yahoo.com)
Date:21 Mar 2006 08:56:50

Gambit,
Any idea ? Do you need to see anything else, other pieces of code maybe ?

> Gambit, we will just patiently wait for you to be back. :)
> Thanks,
> ilya
>
> > Strange thing that we have 10+ applications working without problems on th
> e
> > same box with the same emailserver, but different email boxes. Only one wa
> s
> > stuck with 'Connection Closed Gracefully'. As soon message in question was
>  r
> > emoved - everything went just fine.
> >
> > Piece of code:
> >
> > procedure TEmailRetriever.Execute;
> > var
> >   msgCount, i, iEmailSize: integer;
> > begin
> >   Disconnect;
> >   try
> >     Connect;
> >     SetStatus('Get number of messages');
> >     msgCount := GetMessageCount;
> >     SetStatus(Format('%d messages on server', [msgCount]));
> >     if msgCount = 0 then
> >       Disconnect;
> >     i := 1;
> >     while (i <= msgCount) and not ManualStop do
> >       try
> >         Application.ProcessMessages;
> >         {we just added that, but as you said it is not necessary.}
> >         if (not Connected) then
> >           Connect;
> >         Msg.Clear;
> >         EmailFileList.Clear;
> >         SetStatus(Format('Retrieving message size #%d', [i]));
> >         iEmailSize := GetMessageSize(i) div 1024;
> >         SetStatus(Format('Message size #%d is %dKB',[i, iEmailSize]));
> >         if iEmailSize > FMaximumSizeInKB then
> >           begin
> >             SetStatus(Format('Skip message #%d. It is too big to be proces
> se
> > d (Size: %d, MaxAllowed: %d)', [i, iEmailSize, FMaximumSizeInKB]));
> >             inc(i);
> >             continue;
> >           end;
> >         SetStatus(Format('Retrieving message #%d', [i]));
> >         RetrieveMessage(i, Msg);
> >
> >         SetStatus(Format('Get attributes of message #%d ',[i]));
> >         EmailAttribs.GetMessageAttribtures(msg);
> >         SetStatus(Format('Save attributes of message #%d ',[i]));
> >         EmailAttribs.SaveToFile(FTempDir + MsgAttribs);
> >         StringListAddIfUnique(EmailFileList,FTempDir + MsgAttribs);  //Ema
> il
> > FileList.Add(FTempDir + MsgAttribs);
> >
> >         SetStatus(Format('Saving message #%d', [i]));
> >         if not SaveMessage(msg) then
> >           begin//SK - where exactly is this exception?
> >             SetError('Error saving attachment. Skipping the message.', Fal
> se
> > );
> >             inc(i);
> >             continue;
> >           end;
> >
> >        [not pop3 related piece of code got skipped]
> >
> >         if WasRegistered then
> >           begin
> >             SetStatus(Format('Delete message #%d', [i]));
> >             DeleteMsg(i);
> >           end;
> >         inc(i);
> >         Application.ProcessMessages;  // process any clicks on the stop bu
> tt
> > on, etc.
> >       except on E: Exception do
> >         begin
> >           SetError(Format('Problems working with POP3/IMAP server. MailBox
> Na
> > me: %s. Error: %s.', [FMailBoxName, E.Message]), False);
> >           inc(i);//skip the current message - we will try it again in the
> ne
> > xt go around
> >           Application.ProcessMessages;
> >           Sleep(5000);
> >         end;
> >       end; //while i <= msgCount and ManualStop = False
> >   finally
> >     Disconnect;
> >   end;
> > end;
> >
> >
> > procedure TEmailRetrieverPop3.RetrieveMessage(MsgNo: integer;
> >   AMsg: TIdMessage);
> > begin
> >   POP.Retrieve(MsgNo, AMsg);
> > end;
> >
> >
> >
> >
> > >
> > > "ilya ovsishcher" <iomongol@yahoo.com> wrote in message
> > > news:727D595F2EF1E240iomongol@yahoo.com...
> > >
> > > > Other day we discovered an issue with POP3 component. It tries
> > > > to download message A, but for some reason it is failing to do so
> > >
> > > Just saying it fails doesn't say anything about the actual problem.  Is
> an
> > > error being reported?  Is an exception being thrown?
> > >
> > > > it is loosing connection to the server.
> > >
> > > That is because the server is actively disconnecting the connection on
> > > purpose.  Your own log shows that.  That is what "Connection Closed
> > > Gracefully" means - the other party intentionally closed the socket on i
> ts
> > > end.
> > >
> > > > We patched our code to check if component connected for every email
> > >
> > > That is not necessary.
> > >
> > > > Please let us know is anything can be done to avoid such situation in
> > > > the future.
> > >
> > > There is no way to diagnose your problem without more details.  Your log
> > > does not show what your actual code is doing.  Please show your actual c
> od
> > e.
> > >
> > > > One important details is that before BOUNDARY_OUTLOOK there is
> > > > character with code of 01. Maybe it is important
> > >
> > > It might be.  At the very least, TIdMessage is probably failing to parse
>  t
> > he
> > > message data that was downloaded.  That is not a TIdPOP3 problem, and th
> e
> > > connection should remain open as long as the raw data was transmitted
> > > properly.
> > >
> > >
> > > Gambit

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive