SHARE
TWEET

Untitled

a guest Nov 19th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public static String getAddress() {
  2.         String address = "";
  3.         try {
  4.             Socket socket = new Socket();
  5.             socket.connect(new InetSocketAddress("google.com", 80));
  6.             address = socket.getLocalAddress().getHostAddress();
  7.             socket.close();
  8.         }
  9.         catch(Exception e){
  10.             System.out.println("Failed to get local address");
  11.         }
  12.         return address;
  13.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top