To get the boolean value for the hit on the ip
public Boolean getInetAddressByName(String name)
{
AsyncTask<String, Void, Boolean> task = new AsyncTask<String, Void, Boolean>()
{
@Override
protected Boolean doInBackground(String... params) {
try
{
return InetAddress.getByName(params[0]).isReachable(2000);
}
catch (Exception e)
{
return null;
}
}
};
try {
return task.execute(name).get();
}
catch (InterruptedException e) {
return null;
}
catch (ExecutionException e) {
return null;
}
}