java - Get Network Computer Names -


i'm looking better way computer names in lan network java. have tried:

byte[] ip = {(byte)192,(byte)168,(byte)178,(byte)1};     for(int i=1;i<255;i++)     {         ip[3] = (byte)i;         try         {             inetaddress addr = inetaddress.getbyaddress(ip);             string s = addr.gethostname();             system.out.println(s);         }         catch(unknownhostexception e)         {             system.out.println(e.getmessage());         }     } 

... it's slow. there other way?

i on windows.

any ideas appreciated.

you can increase speed using multiple threads.

have each thread execute 1 or more of iterations of 'try' block.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -