?
Solved

Javamail: What is the function of the "mail.pop3.timeout" and "mail.pop3.connectiontimeout" properties in plain Engish?

Posted on 2014-09-06
5
Medium Priority
?
558 Views
Last Modified: 2014-09-06
I'm working with a legacy app that downloads POP3 emails with javamail.  Despite reading the docs, I'm not sure I completely understand the purpose of these two properties.

mail.pop3.connectiontimeout
mail.pop3.timeout

Can anyone explain what they do in plain english and provide a real world example of when they might be used?

TIA
0
Comment
Question by:_agx_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 28

Accepted Solution

by:
dpearson earned 2000 total points
ID: 40307970
mail.pop3.connectiontimeout is how long you are willing to wait to make an initial connection to the POP3 mail server.  E.g. If you set this to 30 secs, then if you try to connect to a POP3 server and get no response inside 30 seconds, you'll give up and return an error.

mail.pop3.timeout is after you have connected to the mail server, how long you are willing to wait to get data back as you are reading mail messages.  So again if you set it 20 seconds, this means after you ask to read an email if you don't get a response inside of 20 seconds, you'll give up an report an error.

The practical choice is between responsiveness (how quickly do you report an error when there's a problem) against how forgiving you are of slow servers/networks.

If you were implementing an internal mail server for use in a corporate setting, it might be fine to have 15 sec timeouts - because that's really slow in a commercial environment and so if it takes that long you can give up and show an error because it's not likely just being slow.  But if you were connecting to a globally accessible server from potentially anywhere in the world, you might set the timeouts to 3 mins, because e.g. connecting to the US from India or China can often be very slow.

Does that help explain things?

Doug
0
 
LVL 52

Author Comment

by:_agx_
ID: 40307975
Thanks, that's a clear explanation. I was thinking "mail.pop3.timeout" might be an overall timeout, similar to a session timeout in a web app.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 40307984
Let's say you've got a new hosting provider and you want to test whether their mail server is working ok. You write a program that tries to connect to it every 5 minutes and check the number of mails in your inbox. So you used a scheduled task. There a two stages of connection

a. connecting to the mail server with a TCP/IP socket
b. implementing the protocol when you've connected to get the count of the messages in your inbox

So you do a. and you try to connect to the server. It doesn't connect and seems down. But how long are you going to wait until you've decided it IS down and mark that attempt as a fail? That time is actually set by mail.pop3.connectiontimeout. After that time, an exception will be thrown that you can catch and mark the attempt as a failed connection.
In the next scenario you DO connect but there seem to be problems waiting for the greeting from the server. Again - how long do you wait? That time is set by mail.pop3.timeout
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 40307986
An uncharacteristically long answer from me - result - it took far too long ;)
0
 
LVL 52

Author Comment

by:_agx_
ID: 40308232
CEHJ - Thanks for the response. I closed this one so fast, I didn't even see it until later :)
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month9 days, 2 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question