boolean isHostReachable(String address) { try { URL url = new URL(address); HttpURLConnection urlc = (HttpURLConnection) url.openConnection(); urlc.setRequestProperty("User-Agent", "userAgent"); urlc.setRequestProperty("Connection", "close"); urlc.setConnectTimeout(1000 * 10); urlc.connect(); if (urlc.getResponseCode() == 200) { urlc.disconnect(); return true; } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return false; }
В коде ничего сложного нет: создаём подключение к интересующему хосту, задаём user agent, таймайт в миллисекундах, подключаемся и проверяем код ответа, после чего тут же отключаемся.
Hi,
ОтветитьУдалитьI am a student and Mac OS X is new for me. I got an assignment . My aim is to hook MAC OS X at boot time after this i want to run my application to do some operation on boot volume. Then boot volume must be mount.
Basically when i run my application then system must be reboot. After this reboot and before mounting of boot volume i want to do some operation on that boot volume . Then boot volume must be mount after that reboot.
For this i am trying to boot my system from ram with the help of that boot volume on which i want to do some operation.
For this i m using hdik , hdid , hdiutil command .
Basically i want to mount my boot volume into RAM at reboot time.
If you know any method , please guide me.
Kindly help me.
Casino | DrmCD
ОтветитьУдалитьCasino · 양주 출장마사지 Lifestyle · Things to Do · Promotions and Games · Events · 의정부 출장샵 Travel Guides · 광양 출장마사지 Contact 보령 출장샵 Us · Login 거제 출장안마