title: How To Check Server or Ip Address available/connected in Android
body: <p>How to Know server/ip address is available / connected in android.
  I try this code </p>
  
  <pre><code>final EditText ed_ip = (EditText)findViewById(R.id.ed_server);
  Button btn_ip_save = (Button)findViewById(R.id.btn_save_ip);
  
  btn_ip_save.setOnClickListener(new OnClickListener() {
  
  @Override
  public void onClick(View v) {
  // TODO Auto-generated method stub
  
  String str_serverip = ed_ip.getText().toString();
  int timeout = 2000;
  
  byte [] b = str_serverip.getBytes();
  
  boolean addr = InetAddress.getByAddress(b).isReachable(timeout);
  
  if(addr == true)
  {
         txt.setText("Response");
        Toast.makeText(IpConfig.this, "Reachable", Toast.LENGTH_LONG).show();
  
  }else {
  
      txt.setText("Not Response");
      Toast.makeText(IpConfig.this, "Not", Toast.LENGTH_LONG).show();
      }
  
  
  }       
  </code></pre>
  
  <p>its always refuse connection except 127.0.0.1</p>
  
  <p>How to check plz guide me ..        </p>