title: how to check connectivity of an ip address on specific port?
body: <pre><code>public boolean isReachable(String ipAddress, int port, int timeout)
  {
      Socket socket = new Socket();
      Exception exception = null;
      try {
          socket.connect(new InetSocketAddress(ipAddress, port), timeout);
      }
      catch (IOException e) { exception = e; }
  
      finally {
          try { socket.close(); } catch (Exception e) {e.printStackTrace(); }
      }
      return exception == null;
  
  }
  </code></pre>
  
  <p>this code works when i am connected to the internet. but it also works when i am disconnected from ISP side.(like when adsl service date is expired or the traffic is finished).
  please tell me where the problem is?</p>