Results 1 to 2 of 2
  1. #1
    ankurgupta's Avatar
    ankurgupta is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Question How to check internet connectivity?

    Hi Frnds,
    I wanna to write a prog to check whether internet is connected or not.
    I tried using URL api or pinging Google
    but in both the cases i was not satisfied with the solution.


    can anyone provide me any other way to solve this prob.

  2. #2
    ankurgupta's Avatar
    ankurgupta is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Default

    I tried with the following solution



    public boolean getConnectivityStatus(String urlAddress) {
    boolean connStatus = false;
    try {
    URL url = new URL(urlAddress);
    URLConnection conn = url.openConnection();
    conn.connect();
    connStatus = true;
    } catch (MalformedURLException e) {
    connStatus = false;
    System.out.println("MalformedURLException");
    e.printStackTrace();
    } catch (IOException e) {
    connStatus = false;
    System.out.println("IOException");
    e.printStackTrace();
    }

    return connStatus;
    }




    can anyone provide me any other solution

Similar Threads

  1. DB Connectivity
    By suresh.sa in forum Advanced Java
    Replies: 1
    Last Post: 11-02-2010, 10:46 AM
  2. database Connectivity
    By arjun_duddu in forum JDBC
    Replies: 2
    Last Post: 08-29-2010, 04:56 AM
  3. database connectivity
    By rilwanfit in forum Networking
    Replies: 1
    Last Post: 03-13-2009, 07:54 PM
  4. sql connectivity
    By prashant in forum JDBC
    Replies: 2
    Last Post: 12-27-2008, 04:05 AM
  5. ensure connectivity
    By perdoname in forum JDBC
    Replies: 1
    Last Post: 04-22-2008, 02:29 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •