Author |
|
zedekiah Groupie
Joined: 24 June 2009 Location: United States
Online Status: Offline Posts: 44
|
Posted: 17 July 2009 at 8:43am | IP Logged
|
|
|
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 |
|
|
zedekiah Groupie
Joined: 24 June 2009 Location: United States
Online Status: Offline Posts: 44
|
Posted: 17 July 2009 at 8:44am | IP Logged
|
|
|
I meant, check every 15 minutes to see that imp.connect == true and imp.isidle = true
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 17 July 2009 at 9:45am | IP Logged
|
|
|
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 |
|
|
zedekiah Groupie
Joined: 24 June 2009 Location: United States
Online Status: Offline Posts: 44
|
Posted: 17 July 2009 at 10:29am | IP Logged
|
|
|
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 |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 17 July 2009 at 10:45am | IP Logged
|
|
|
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 |
|
|