Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET IMAP

 AfterLogic Forum : MailBee.NET IMAP
Subject Topic: Idle Thread unexpectedly dies Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
zedekiah
Groupie
Groupie


Joined: 24 June 2009
Location: United States
Online Status: Offline
Posts: 44
Posted: 17 July 2009 at 8:43am | IP Logged Quote zedekiah

Yesterday we discovered that the idle connection to the Exchange Server dies without any cause. Either the exchange server stops sending messages or the code is no longer listening for them. Is there a way to set a timer and check every 15 minutes that the mail server is indeed listening?
the other problem is our application goes down at night for maintenance. When it comes up there is mail in the mailbox but the exchange server does not send an update message on what is there (EXISTS). So the idle process must wait until a new message comes before processing the ones sitting there.
Back to Top View zedekiah's Profile Search for other posts by zedekiah
 
zedekiah
Groupie
Groupie


Joined: 24 June 2009
Location: United States
Online Status: Offline
Posts: 44
Posted: 17 July 2009 at 8:44am | IP Logged Quote zedekiah

I meant, check every 15 minutes to see that imp.connect == true and imp.isidle = true

Back to Top View zedekiah's Profile Search for other posts by zedekiah
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 17 July 2009 at 9:45am | IP Logged Quote Alex

The mail server closes the connection after 30 minutes of idling - this is normal and described in IMAP RFC. Your application indeed should use Timer or any other other mechanism to call StopIdle and then Idle again every 15 m minutes or so.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
zedekiah
Groupie
Groupie


Joined: 24 June 2009
Location: United States
Online Status: Offline
Posts: 44
Posted: 17 July 2009 at 10:29am | IP Logged Quote zedekiah

Do you have an example of how to check, because I noticed that imp.connected == true
and imp.isidle == true in spite of the fact that the mailserver is down
Does it hurt to just start again every 30 minutes, or does that hose up the exchange server?
Back to Top View zedekiah's Profile Search for other posts by zedekiah
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 17 July 2009 at 10:45am | IP Logged Quote Alex

Quote:
Do you have an example of how to check, because I noticed that imp.connected == true
and imp.isidle == true in spite of the fact that the mailserver is down

You do not need to check if the connection is still there or not. Mail server will certainly close it after 30 minutes of inactivity.

Moreover, you can't check if the connection is still valid or not. Obviously, IsIdle may be true even if the mail server already closed the connection. IsIdle is just a property which is set to true when you connect and to false when you disconnect. But the remote mail server can't set it to false. But you don't know that the mail server is already dead until you send it something again (this will fail and MailBee will close the connection and set IsIdle to false). This is because if the mail server stops accepting data from the client, the client can't determine this in any way without sending any data to the server. This is how TCP/IP protocol works. Although it declares a procedure of sending zero-length data packet to the client to tell it that the server will no longer accept data from the client, many mail servers do not do this and you have no way to determine the moment of closing the connection.

In short, simply call StopIdle after 15 minutes and then Idle again. There is no way to catch the moment when the server itself closed the connection.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide