Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

POP3 - java.net.ConnectException: Connection timed out: connect  RSS feed

 
Omkar Shetkar
Ranch Hand
Posts: 100
2
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am trying to connect to the gmail POP3 mail server using Java Socket connection. But I am getting
"java.net.ConnectException: Connection timed out: connect"
exception. How to set the timeout property of Socket before actually connecting to the mail server? Thanks in advance.
[ October 21, 2008: Message edited by: Omkar Shetkar ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're timing out, it's most likely due to a firewall or connectivity issue -- i.e., something between you and the server is blocking your packets. Check with your local network admins.
 
Pat Farrell
Rancher
Posts: 4686
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can debug a bit of it with a shell, connecting manually.
Just do:

telnet <hostname> 110

and see if it connects, if not, you have a firewall, access, or other problem.
 
Omkar Shetkar
Ranch Hand
Posts: 100
2
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply. I tried with the telnet command, it is not getting connected. May be a security setting avoiding the connection. Will check.
 
Devasia Manuel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This a is a very common problem, if you want to connect to gmail...You have to go to your gmail account and allow pop3 connection. If you don't, you will get this exception. Try this and tell me if it works...

If the above doesn't work, check if you types pop3 as "pop3" not "POP3" in your code. But I think this gives a NoSuchProviderException not a ConnectionTimeOut
[ November 03, 2008: Message edited by: Devasia Manuel ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!