get current url from a network in java

0

I need some way to get the url's accessed on a computer network, I've seen a lot of things, I found a code that uses socket but it's a host only, but it can not be an individual host , I want the whole network, some class or an example of how to do it

ps: not a server servlet

    
asked by anonymous 22.10.2014 / 01:38

1 answer

1

I do not quite understand, but this catches all hosts on a lan

public void checkHosts(String subnet){
   int timeout=1000;
   for (int i=1;i<254;i++){
       String host=subnet + "." + i;
       if (InetAddress.getByName(host).isReachable(timeout)){
           System.out.println(host + " is reachable");
       }
   }
}

//call
checkHosts("192.168.0");
    
08.11.2014 / 02:52