Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.net.ConnectException: Connection timed out VS java.net.SocketTimeoutEx

843790Jul 20 2009 — edited Jul 20 2009
Can some one explain me why setConnectTimeout() doesn't function here? Thanks in advance.

I was using the following code to connect a server application:
HttpURLConnection connection= (HttpURLConnection)url.openConnection();
connection.setConnectTimeout( 60000 );
connection.setReadTimeout( 600000 );

While it was running, I issued an iptables command to block the server side and I was expecting the connection would time out in 10 minutes.
However, just a 2-3 minutes later, java.net.ConnectException: Connection timed out showed up.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 17 2009
Added on Jul 20 2009
5 comments
325 views