w1ntz

internetcheck

Jul 10th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. package com.example.win8pro.globish;
  2.  
  3. import java.net.InetAddress;
  4.  
  5. /**
  6.  * Created by Win 8 Pro on 7/7/2558.
  7.  */
  8. public class internetCkeck {
  9.     public static boolean isInternetAvailable() {
  10.         try {
  11.             InetAddress ipAddr = InetAddress.getByName("google.com");
  12.  
  13.             if (ipAddr.equals("")) {
  14.                 return false;
  15.             } else {
  16.                 return true;
  17.             }
  18.  
  19.         } catch (Exception e) {
  20.             return false;
  21.         }
  22.  
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment