Board index » delphi » Re: IMAP4 RetrievePeek problem

Re: IMAP4 RetrievePeek problem


2003-06-26 01:57:29 PM
delphi8
Hi Ciaran,
Greetings. Thanks for your effort in providing a better solution for current
IMAP4 implementation in Indy. After trying the latest version from the URL,
I managed to use RetrieveTextPeek2 to read the mail content. Unfortunately,
I face another problem this time, i.e. when trying to disconnect, or upon
exiting my app, an exception will be raised:
EIdClosedSocket: Disconnected
Obviously the Connected function has returned a wrong value. Is there any
pointer to this?
Best wishes,
jr
 
 

Re: IMAP4 RetrievePeek problem

"Junior Ang" <XXXX@XXXXX.COM>writes
Quote
Hi Ciaran,

Greetings. Thanks for your effort in providing a better solution for
current
IMAP4 implementation in Indy. After trying the latest version from the
URL,
I managed to use RetrieveTextPeek2 to read the mail content.
Unfortunately,
I face another problem this time, i.e. when trying to disconnect, or upon
exiting my app, an exception will be raised:

EIdClosedSocket: Disconnected

Obviously the Connected function has returned a wrong value. Is there any
pointer to this?

Best wishes,
jr

Sorry.
In Destroy, change:
Disconnect;
to:
if Connected then Disconnect;
I will post this change in a later release.
Ciaran
 

Re: IMAP4 RetrievePeek problem

"Junior Ang" <XXXX@XXXXX.COM>writes
Quote
Hi Ciaran,

>Sorry.
>
>In Destroy, change:
>
>Disconnect;
>
>to:
>
>if Connected then Disconnect;
>
>I will post this change in a later release.
>
>Ciaran

Thank you very much for you follow-up, that solved my problem :) But I am
currently facing another problem, i.e. when the IMAP4 component is
connected, and I just close the connection and exist, my app will throw an
error...

EIdSocketError 'Socket Error #10038 Socket operation on non-socket.'

procedure TIdStack.RaiseSocketError(const AErr: integer);
begin
raise EIdSocketError.CreateError(AErr, WSTranslateSocketErrorMsg(AErr));
// --->error being raised here
...
end;
I don't get any error like that (I do use TIdImap for all my email). Look
at the Call Stack, your code might be trying to do something with a closed
socket?
Ciaran
 

Re: IMAP4 RetrievePeek problem

Hi Ciaran,
Thanks for your follow-up again. I think I managed to isolate the problem...
Quote
I don't get any error like that (I do use TIdImap for all my email). Look
at the Call Stack, your code might be trying to do something with a closed
socket?

Ciaran

I ran a few test with the following conditions:
1. disconnect myself from Internet connection
2. try to connect to an IMAP account
3. while it is busy trying to establish the connection (which is not
possible), disconnect the IMAP account (without existing the app), then I
got this error:
Socket Error # 10057
Socket is not connected.
4. If I disconnect the IMAP account and immediately exit, I received the
error mentioned in my previous post.
5. from my perspective, I found that the exception is mainly raised from the
following SendCmd and apparently the Connected property has failed to
indicate the actual connection status...
procedure TIdIMAP4.Disconnect;
begin
//Available in any state.
if Connected then
begin
try
SendCmd ( NewCmdCounter, IMAP4Commands[cmdLogout], wsOk );
finally
inherited;
FConnectionState := csNonAuthenticated;
end;
end
else
begin
raise EIdClosedSocket.Create ( RSStatusDisconnected );
end;
end;
Hope that helps.
Best wishes,
jr