• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

IP Discovery using java

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How would you do this in C?
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I want my playground back. Here, I'll give you this tiny ad for it:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic