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.
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:
Google Distance API is a paid service, which requires billing account. Connectivity to API may fail when quota / billing had exhausted.
API requires a key for authorization. Connectivity can fail if the key had expired.
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.