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 7536787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:40:19+00:00 2026-05-30T06:40:19+00:00

I am working on a project that communicates to a server through a URLConnection.

  • 0

I am working on a project that communicates to a server through a URLConnection.

Here is the code:

URL theSite;
theSite = new URL(TestURL);
URLConnection con = theSite.openConnection();

BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));

However this is taking my Motorola Atrix and Samsung Nexus S about 20 seconds or more to when talking with the server. (Information does get sent eventually it seams) Looking at the packets in wireshark, I’ve found that there are many groups of DNS packets sent which with about 3-5 seconds between each one. This is likely the cause of the slow communication.

Here is are two sample DNS packets. (I’ve changed the IP’s, except for the destination of 8.8.8.8 which I believe is google)

Time         Source    Destination  Protocol   Info
20.308792 10.10.120.104  8.8.8.8    DNS       Standard query PTR 3.120.10.10.in-addr.arpa
25.360726 10.10.120.104  8.8.8.8    DNS       Standard query PTR 3.120.10.10.in-addr.arpa

Anyways, this happened today out of the blue. But it is very apparent that it is these DNS calls that are causing slow communication between the server and my device.

Another thing of note, is that I have also tried the EXACT same code on the Samsung Galaxy 10.1 tablet and it works fine. Looking at the packet trace there are no Extra DNS calls from the tablet.

I don’t have control over the server, and had the packets sent to me. Does anyone have any suggestions? I’m guessing that it is a server related issue. If anyone has any ideas, it is much appreciated.

Thanks!

  • 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-30T06:40:20+00:00Added an answer on May 30, 2026 at 6:40 am

    We have figured this out. Turns out on the servers side, there were issues routing DNS packets and they kept timing out which they have fixed.

    Something we added to help make sure that this issue doesn’t happen again, is manually setting the DNS timeouts so that after failing once, the DNS packet timeout will be almost instant. Using InetSocketAddress is the key.

    Here’s some sample code to get this working.

        int timeout = 0; //How ever long you want to set the timeout to. 
        somePageParameters = "Parameter String";
        InetSocketAddress isock = new InetSocketAddress(ip, 1000);
        Socket s = null;
        s = new Socket();
        s.connect(isock,timeout);
        OutputStream os = s.getOutputStream();
        String myString = "";
        myString = "GET "+"/"+ somePageParameters+" HTTP/1.0\n\r\n\r";
        System.err.println("Hitting with: "+myString);
        byte outbuf[] = myString.getBytes();
        os.write(outbuf);
        os.flush();
    

    Then use this socket as you normally would.

    Hopefully this helps someone.

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

Sidebar

Related Questions

In near future I'll need to start working on a new project that consist
I'm working on a RESTish server project that responds to HTTP requests in a
I'm currently working on a project in .NET that communicates with native C++ libraries
I'm working on project that need to control sending queue by code. So I
I am working a project that does not have a trunk / branches /
I'm working on project that lets users choose some scientific authors and columnists and
Working on a project that parses a log of events, and then updates a
I´m working on a project that basically will show some data collected from hardware
I am working on a project that requires the manipulation of enormous matrices, specifically
I'm working on a project that will be distributed with GNU autoconf/automake, and I

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.