File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Distributed Java and the fly likes Finding the computers that are on a network Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Finding the computers that are on a network" Watch "Finding the computers that are on a network" New topic

Finding the computers that are on a network

Bill White
Ranch Hand

Joined: Oct 27, 2002
Posts: 82
Is there an API out there that can do this?
Here is the problem. I have an app that needs to know about the other machines that are on the network that the apps computer is on.
I have looked at JNDI and JINI very briefly but they both seem to need to know a computers name before being able to connect to it. Unfortunately, I don't have that information to start with
I need the ability to query a network for all the machines on a network, thier I.P's and even the Mac Addresses.
Thank You.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17423

I think the first thing you need to determine is what you mean by "on" the network. There are 7 levels to an OSI networking model and what I mean when I say network depends on what layer I'm talking about and what services I'm referring to. Just because the machine down the hall and I both log into the same file server doesn't mean we both participate in webservices on the same "network", for example. Conversely, two machines can reside on 2 different LAN segments and still be on the same "network". Or for that matter, so can 2 machines on opposite sides of the planet.
One definition of "network" might be a LAN segment, which in TCP/IP means averyone shares the same address after masking off host IDs. But IPX networks don't work that way.
Then there's the question of my laptop. Is it "on the network" when it's dormant?
And, just in case the waters aren't muddy enough, two machines may be on the Internet. That's a network. However, if the only services they have are the ability to make http requests, machine A can never discover machine B, since, while thy may both be able to talk to host C, the HTTP protocol doesn't allow for hosts to make unsolicted requests of client machines.
So, in the general case, no. Specific cases sometimes. Worms like Code Red didn't do their dirty work by knowing who else was on the network, they did it by either plundering well-known system resources such as Microsoft LookOut address books or by simply bombing IP addresses formed semi-randomly.

An IDE is no substitute for an Intelligent Developer.
Bill White
Ranch Hand

Joined: Oct 27, 2002
Posts: 82
Ok, lets say I just want to find the computers in my companies network. About 20 of em. I will be using TCP/IP.
With TCP/IP I want an application that can find the other 19 computers that are powered up on my companies network in the actual physical location of my company.
Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

Sumpn like this?
[ February 22, 2003: Message edited by: Michael Ernest ]

Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Bill White
Ranch Hand

Joined: Oct 27, 2002
Posts: 82
It seems that Janos needs its own version of a JVM. Is this the case?
If so, it will not work for what I am doing. Thanks a bunch though.
I agree. Here's the link:
subject: Finding the computers that are on a network
It's not a secret anymore!