aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Listing Machines in a LAN Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Listing Machines in a LAN" Watch "Listing Machines in a LAN" New topic
Author

Listing Machines in a LAN

Prashant Sehgal
Ranch Hand

Joined: Jun 20, 2003
Posts: 56
Hi,

I was going through the InetAddess/NetworkInterface family of classes and was wondering if it was possible to use the java.net library to list all the machines in a LAN? I tried my hand at it and was not quite sure what to do. Anybody here tried anything like that?
Sushil Sharma
Greenhorn

Joined: Nov 02, 2006
Posts: 22
The host on which your application runs, knows other hosts -- on same LAN -- via ARP protocol. And these IP addresses are not available to JVM.

The only way I can think is to get IP subnet address of your host, and try

for (all host addresses on the subnet) {
InetAddress inet = InetAddress.getByAddress(address);
inet.isReachable();
}

Google to check if someone has written this type of utility.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18134
    
    8

If it's a Windows network then possibly JCIFS could do that for you.
Prashant Sehgal
Ranch Hand

Joined: Jun 20, 2003
Posts: 56
Thanks guys. I will give these things a shot before I come back with more questions .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Listing Machines in a LAN
 
Similar Threads
How can I get the IP address of PC in a LAN correctly?
Help,I will upload my work after handle the problem.
Machines in a network
Is there any method to get address of all machines in network
list all machine name and ip addresses in LAN using java