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
1
You can use these code snippet for exception haldling:
HttpURLConnection urlConnection = (HttpURLConnection) callUrl.openConnection();
urlConnection.setReadTimeout(30000);
urlConnection.setConnectTimeout(30000);
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
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..