• Post Reply Bookmark Topic Watch Topic
  • New Topic

IP Discovery using java  RSS feed

 
Prasad Katti
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,
Is it posible to discover all the machines in the network using java? Or do we have code in C and then use a Java wrapper around it?
regards
prasad
 
Michael Chermside
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would you do this in C?
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prasad,
Welcome to JavaRanch. The short answer is no since the java.net package doesn't support raw sockets which is required to use the ARP protocol. The longer answer is probably either by using native code as you suggested, or a Runtime.exec() command that would enumerate all the nodes on a LAN. Either of these methods is going to be platform specific. You could use the latter method using the native ping and parse the results of an entire subnet. That has several problems, performance being one and the possibility that firewalls are filtering ICMP packets. There is one other possibility,
JPCap, which can handle raw sockets, but the support for APR is really crude and you will have to fully understand to protocol to use it since you will need to build the packets from scatch.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!