Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET IMAP

 AfterLogic Forum : MailBee.NET IMAP
Subject Topic: Timeout Exceptions & IsConnected property Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
hmuscroft
Groupie
Groupie


Joined: 29 December 2009
Location: United Kingdom
Online Status: Offline
Posts: 72
Posted: 02 February 2017 at 3:34am | IP Logged Quote hmuscroft

In my app, I do some "connection caching" to improve performance.

Basically, when an "Imap" object is constructed, it is cached and then re-used for further operations on the same IMAP server, to save having to repeatedly re-connect and re-login.

After a period of inactivity (usually a few minutes), the cached Imap objects will throw one of the following exceptions when re-used :-

- MailBeeAbortedByRemoteHostException
- MailBeeSocketResetException


This isn't a big problem as I can just destroy the now invalid Imap object, re-create it, login and retry the operation.

However I have two questions please :-

[1] Whenever I'm about to re-use a cached Imap object, I call the ".IsConnected" proeprty to check if it's still connected. It always seems to return TRUE, but then when I then perform the operation, I get one of the 2 exceptions mentioned above.

Presumably .IsConnected doesn't actually check with the server to see if it really is still connected? Is there a different method/property to use to achieve this?

[2] Does the above approach (with regard to caching IMAP objects) sound reasonable or would you recommend a different approach?

Many thanks for your excellent continued support!

Regards,

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

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 02 February 2017 at 3:41am | IP Logged Quote Alex

[1] Yes, IsConnected just reports the last known object state.

[2] You can call Noop every minute or so to keep connection alive (you'll still need to handle exceptions above).

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


Joined: 29 December 2009
Location: United Kingdom
Online Status: Offline
Posts: 72
Posted: 02 February 2017 at 3:46am | IP Logged Quote hmuscroft

Ah OK... so would you recommend calling "Noop()" at intervals, or would it be better to call ".Noop()" in place of ".IsConnected" before an operation to test if the connection is still valid and then re-create it if not?

I guess that I'm concerned that if the client app has 10 IMAP accounts, and there are 20 network users all logged on (to their own instance of the app), then that's 200 imap connections being "Noop'ed" every minute to keep them open.
Back to Top View hmuscroft's Profile Search for other posts by hmuscroft
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 02 February 2017 at 3:51am | IP Logged Quote Igor

To minimize traffic, you can use IDLE approach for every connection, you can find the detailed description and sample here.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
hmuscroft
Groupie
Groupie


Joined: 29 December 2009
Location: United Kingdom
Online Status: Offline
Posts: 72
Posted: 02 February 2017 at 6:18am | IP Logged Quote hmuscroft

OK - thanks for that.
Back to Top View hmuscroft's Profile Search for other posts by hmuscroft
 

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