Skip to content Skip to sidebar Skip to footer

Android Java.net.sockettimeoutexception: Connection Timed Out

Recently I have encounter the following error in my program: 11-18 12:30:30.259: W/System.err(21368): java.net.SocketTimeoutException: Connection timed out 11-18 12:30:30.259: W/Sy

Solution 1:

There are two possibilities,

1)have you checked and tested your connection.

2)better don't set any connection timeout,if you are setting chose maximum time,,bcos it throws an error,if server didn't response within given time..

Solution 2:

You can use these code snippet for exception haldling:

HttpURLConnectionurlConnection= (HttpURLConnection) callUrl.openConnection();
urlConnection.setReadTimeout(30000);
urlConnection.setConnectTimeout(30000);

Solution 3:

this type of exception can also occur if firewall blocks the http or https service and to unblock that goto

firewall->advanced settings -> and check the http or https options and saveenter image description here

Post a Comment for "Android Java.net.sockettimeoutexception: Connection Timed Out"