Archived Forum Post

Index of archived forum posts

Question:

Set TimeOut Imap

Jun 30 '15 at 16:08

I would set timeout greater then 60000 ms. I have used the method 'put_ConnectTimeout(300) or putConnectTimeout(300000)', but nothing... the timeout is always 60000 ms.

I have seen this link: https://www.chilkatsoft.com/p/p_407.asp and setted IdleCheck at 120000 but nothing...

I can set timeout at infinite ? How ?

This is my code:

  m_imap->put_ConnectTimeout(300);
   m_imap->idleCheck(120000);
   m_imap->SelectMailbox(pszFolder);

   m_messageSet = 0;
//  We can choose to fetch UIDs or sequence numbers.
bool fetchUids;
fetchUids = true;
//  Get the message IDs of all the emails in the mailbox
   CString filter;
   if (lDateFrom>0 || lDateTo>0)
   {
         if (lDateFrom>0 && lDateTo>0)
                filter.Format("SENTSINCE %d-%s-%d SENTBEFORE %d-%s-%d",fnday(lDateFrom),GetMonth(lDateFrom),fnyear(lDateFrom,0),fnday(lDateTo),GetMonth(lDateTo),fnyear(lDateFrom,0));
         else
         {
                if (lDateTo>0)
                       filter.Format("SENTBEFORE $d-%s-%d",fnday(lDateTo),GetMonth(lDateTo),fnyear(lDateTo,0));
                else
                       filter.Format("SENTSINCE %d-%s-%d",fnday(lDateFrom),GetMonth(lDateFrom),fnyear(lDateFrom,0));
         }
   }
   else
   {
         filter="ALL";
   }

   //betweenDates = "SENTSINCE 01-Mar-2007 SENTBEFORE 05-Mar-2007";
   m_messageSet = m_imap->Search(filter,fetchUids);

   if (!m_messageSet || m_messageSet == 0 )
   {
         CkString ckError;
         m_imap->LastErrorText(ckError);
         sErrorMsg=ckError.getString();
    return -1;  
   }

//  Fetch the emails into a bundle object:

   if  (flSpeedReading)
         m_bundle = m_imap->FetchHeaders(*m_messageSet);       
   else
         m_bundle = m_imap->FetchBundle(*m_messageSet);

if (m_bundle == 0 ) {
    delete m_messageSet;
    return 0;
}

   int count = m_bundle->get_MessageCount();
   return count;

thanks for your answers


Answer

The web page at https://www.chilkatsoft.com/p/p_407.asp discusses the IdleTimeoutMs property of the FTP2 class, which has nothing to do with the IMAP class.

The Imap.IdleCheck is a method. It is NOT a timeout related property.

The Imap object has 2 timeout related properties: ConnectTimeout and ReadTimeout. It does NOT have an IdleTimeoutMs property.