0

I have a java program which calculates the distance and the journey time between two locations using the google matrix distance API. when I run my program everything goes fine but after a while I get this error:

java.net.SocketTimeoutException: connect timed out
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:606)

Any ideas?

Thank you.

Sercan
  • 2,081
  • 2
  • 10
  • 23

1 Answers1

0

The error message "java.net.SocketTimeoutException: connect timed out"

suggests that the root cause of the problem is due to network connectivity failure. This could have been caused due to these issues:

  1. Google Distance API is a paid service, which requires billing account. Connectivity to API may fail when quota / billing had exhausted.

  2. API requires a key for authorization. Connectivity can fail if the key had expired.

  3. Network connectivity failed between the client computer and the API had failed, possibly due to a faulty internet connection.

Verifying the billing account, API key and network connectivity can help resolve the issue.

Gopinath
  • 4,066
  • 1
  • 14
  • 16