Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7605419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:09:48+00:00 2026-05-31T00:09:48+00:00

I have a problem with request POST/GET in Android. I am trying to handle

  • 0

I have a problem with request POST/GET in Android.
I am trying to handle the error:

Caused by: java.net.SocketTimeoutException: Read timed out

To prevent the crash on my application, I added a timeout of 40 seconds. That works but sometimes 40 seconds is not enough to avoid the error.

I tried to add the “try and catch” but it seems that the error isn’t occurring inside here:

try {
            request.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            localContext.setAttribute(ClientContext.COOKIE_STORE,
                    Backend2.cookieStore);
            response = HttpManager.execute(request, localContext);
            if (response.getEntity() != null) {
                final String r = EntityUtils.toString(response.getEntity());
                return r;
            } else {
                return null;
            }
        } catch (SocketTimeoutException e) {
            e.printStackTrace();
            return null;
        }  catch (UnknownHostException e) {
            e.printStackTrace();
            return null;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }

I am looking for a solution but when I read on stackoverflow and on google, I see only posts like “increase your timeout, add a try, etc..”

I am doing something wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:09:49+00:00Added an answer on May 31, 2026 at 12:09 am

    It’s hard to tell just looking at your catch statement, but maybe you are getting a different error than a SocketTimeoutException? Try to catch an Exception instead to confirm that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use wordpress api, but have unknown problem with my request: First
I'm trying to do an asynchronous request with ASIHTTPRequest, but have some problem getting
I have a problem. I built a script to make a request to an
I have the next problem: I need to process only 1 request at a
I have problem with starting processes in impersonated context in ASP.NET 2.0. I am
I've an annoying ASP.NET problem: I have a Perl script (see below), which gets
I am using this code if form.is_valid(): form.save() if request.POST.get('ajax') == 'true': return HttpResponse('Data
I am fooling around with Authorize.net and I have a problem I'm hoping someone
Every 3 seconds I make an AJAX POST request to get the status of
I need to get POST data with spaces in it. I have folder with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.