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

  • Home
  • SEARCH
  • 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 9127717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:20:51+00:00 2026-06-17T07:20:51+00:00

I need a little help understanding the basics of Jsoup. The following code works

  • 0

I need a little help understanding the basics of Jsoup. The following code works but I’m wondering if the connection needs to be closed somehow. Can’t find anything on the Jsoup website about it. If the application remains untouched after the do in background method executes I get a message in log cat every five minutes or so saying “request time failed: java.net.SocketException: Address family not supported by protocol”. So I want to make sure I’m not unnecessarily consuming data. Thank you.

            protected String doInBackground(String... params) {
        // TODO Auto-generated method stub
        try {
        //  connect to web page based on user input
            Document doc = Jsoup.connect(routeURL).get();


        //  select relevant page elements
            Elements fareStageNumbers = doc.getElementsByClass("fare_stages_inner_table");

       //   test printing out fare stage numbers
            for(Element div : fareStageNumbers){

                Log.v(TAG, div.text());

            }



        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }

logcat message:

    01-12 20:58:28.755: D/SntpClient(78): request time failed: java.net.SocketException: Address family not supported by protocol
    01-12 21:03:28.765: D/SntpClient(78): request time failed: java.net.SocketException: Address family not supported by protocol
    01-12 21:08:28.775: D/SntpClient(78): request time failed: java.net.SocketException: Address family not supported by protocol
  • 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-06-17T07:20:52+00:00Added an answer on June 17, 2026 at 7:20 am

    Jsoup closes the connection by its own, after the request is done:

    // from 'org.jsoup.helper.HttpConnection' class
    static HttpConnection.Response execute(Connection.Request req, HttpConnection.Response previousResponse) throws IOException {
        // ...
        HttpURLConnection conn = createConnection(req);
        HttpConnection.Response res;
        try {
            // ...
        } finally {
            // per Java's documentation, this is not necessary, and precludes keepalives. However in practise,
            // connection errors will not be released quickly enough and can cause a too many open files error.
            conn.disconnect();
        }
        // ...
    }
    

    Exception: Does your url contain the protocol (the url start with eg. http://)?

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

Sidebar

Related Questions

Hi need a little help understanding the following statement and the logic of what
I'm a SQL noob, and I need a little bit of help understanding the
I need little help on following requirement, as I know very little about C
I need a little help with understanding what can I do and cannot in
I need a little help understanding how HTML forms work. It is my understanding
I'm new to android and I'm need a little help understanding how to move
I need a little help understanding something. I am using the colorbox plugin to
I need a little help here. This code correctly displays every format I enter--except
I think I need a little help understanding how a simple Rails 3.2 one-to-one
Hi I need a little help with understanding how to send image uri via

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.