Article View: borland.public.cppbuilder.internet.socket
Article #3163TIdPOP3 connection problems
From: Lapo Guidi
Date: Sun, 13 Nov 2005 02:12
Date: Sun, 13 Nov 2005 02:12
50 lines
2079 bytes
2079 bytes
Hi all,
I have a problem when TIdPOP3 component try to connect to a host while
internet or lan connection are not alive.
I have a simple TThread descendant that check for new messages and all is
working fine when connectivity is present.
The code inside the Execute of the thread is:
void __fastcall TService::Execute(void)
{
TIdPOP3 *POP3=new TIdPOP3(NULL);
try {
POP3->Host="mailserverhost";
POP3->Port=110;
POP3->Username="username";
POP3->Password="password";
try {
POP3->Connect();
int MsgCount=POP3->CheckMessages();
if(MsgCount>0) {
for(int i=1;i<=MsgCount;i++) {
TIdMessage *Msg=new TIdMessage(NULL);
try {
POP3->Retrieve(i, Msg);
// snipped store procedure
}
catch(Exception &e) {
// Reading error
}
POP3->Delete(i);
delete Msg;
}
}
POP3->Disconnect();
}
catch(Exception &e) {
// Connection error
}
}
__finally {
delete POP3;
}
}
I made some errors using these components?
Should I set ReadTimeout property or something similar?
I thought to do Connect(int Timeout) but it doesn't exists.
Any help appreciate.
Lapo
Technical Details
Message-ID:
<4376a0e1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 11508e,e00f97c8a234c11c,start X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Lapo Guidi" <lapoguidi@inwind.it> Newsgroups: borland.public.cppbuilder.internet.socket Subject: TIdPOP3 connection problems Date: Sun, 13 Nov 2005 03:12:39 +0100 Lines: 52 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 NNTP-Posting-Host: 82.57.61.2 Message-ID: <4376a0e1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1131847905 82.57.61.2 (12 Nov 2005 18:11:45 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail