Thursday, 26 May 2016

IP Change In Every 5 minute Code in Java


import java.net.*;

class IPChangeEveryMinute{
    public static void main(String[] args) {
        getIPAddresses();
    }

        public static void getIPAddresses() {
                try {
                        InetAddress in = InetAddress.getLocalHost();
                        InetAddress[] x= InetAddress.getAllByName(in.getHostName());
                        for (int i = 0; i < x.length; i++) {
                                System.out.println(x[i].getHostAddress());
                        }
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }
}

No comments:

Post a Comment