Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String getAddress() {
- String address = "";
- try {
- Socket socket = new Socket();
- socket.connect(new InetSocketAddress("google.com", 80));
- address = socket.getLocalAddress().getHostAddress();
- socket.close();
- }
- catch(Exception e){
- System.out.println("Failed to get local address");
- }
- return address;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement