title: Connection timeout when connecting to server from android device
body: <p>I am trying to connect from my android phone to my server. But I got time-out connection error. what can be the the cause?</p>
  
  <p>note: i have changed my URL link to <a href="http://google.com" rel="nofollow">http://google.com</a> and its working well, so please advice.</p>
  
  <p>my code is</p>
  
  <pre><code>public static boolean bHasInternetAccess() 
      {  
          InputStream in=null;
          int response=-1;
          boolean bHasInternet=true;
  
          try
          {
              URL url=new URL("http://192.168.1.100/AWS.asmx/dtTickets?sTech_ID=-99");
              URLConnection conn= url.openConnection();
              if (!(conn instanceof HttpURLConnection))
              {
                  bHasInternet=false;
              }
              HttpURLConnection httpConn=(HttpURLConnection)conn;
              httpConn.setAllowUserInteraction(false);
              httpConn.setInstanceFollowRedirects(true);
              httpConn.setRequestMethod("GET");
              httpConn.setConnectTimeout(15000); 
              httpConn.connect();
              response=httpConn.getResponseCode();
  
              if (response==HttpURLConnection.HTTP_OK)
              {
                  in=httpConn.getInputStream();
              }
          }
          catch (Exception ex)
          {
              bHasInternet=false;
          }
          if (in==null) {
              bHasInternet=false;
          }
          return bHasInternet;         
      }    
  </code></pre>