want to set timeout for POP3 connection task

Hello,

I have used Java Mail's POP3 protocol to read incoming email & delete it.

Java Mail works fine. But problem is, some times (most probably for connection failure) when I call store.connect(host, username, password);

code gets stuck at this line. And neither goes to next line nor gives any exception.

Is there any way to set timeout (TTL) for store.connect() ?

Here goes some of my code

Properties props =new Properties();

// Get session

Session session = Session.getDefaultInstance(props,null);

// Get the store

store = session.getStore("pop3");

log.debug("Connecting");

store.connect(host, username, password);

log.debug("Connected");

// Get folder

folder = store.getFolder(mailFolder);

folder.open(Folder.READ_WRITE);

( I have got "Connecting" (from log.debug) but can't get "Connected" :( )

Can any one help me please?

Thanks

Regards

-Nahid

[1226 byte] By [strutsa] at [2007-11-27 2:39:43]
# 1
See the javadocs for the com.sun.mail.pop3 package for theproperties you can set to control timeouts.
bshannona at 2007-7-12 3:01:56 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...