I am trying this code in order to ping that ip address in LAN.. the result return is Sorry.
thanks. if u help me
I want to ping that ip of a printer from my device. can i do this.
String ip_address="\\10.28.81.9";
boolean reachable=false;
TextView txt=(TextView) findViewById(R.id.info);
InetAddress address;
try {
address = InetAddress.getByName(ip_address);
reachable =address.isReachable(3000);
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(reachable){
txt.setText("Got it");
}else{
txt.setText("Sorry");
}