Get IP address of all computers in a Network Java code

Posted on 2003-04-01
Medium Priority
Last Modified: 2012-05-04
How can I get the Ip address of all machines in a Network using Java code
If anybody can provide me some sample code or link , it would be of great help

Question by:ngomte
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 35

Expert Comment

ID: 8244422
You can't

You could go through all IP addresses and PING them to see if they are there...  But obviously this would take ages...

The easiest way, is to get people to phone you up with their IP address, or walk around with a pen and a piece of paper, and write them down :-/

Expert Comment

ID: 8244815
You have an application installed on one computer and from there you want to detect the full network or you have an application installed on many computers and you want somehow to know the ip's of those computers from one workstation?

Something to think about for the two situations:

Case1: You can implement a client which listen after broadcasts on the network, on all/specific ports. When it will receive a packet, this packet should contain the ip of the emiter computer.

Case2: If your application is running on multiple stations, you should implement some messaging between application instances. I mean that every application instance should broadcast in the network a 'hello package' so that other running instances can detect'it (they will ask the package after the emiter ip address). After that, every application instance should mentain a list with allready detected IP's. This 'Case2' is specific to network sequrity on some applications, to disable multiusage of the same licence over multiple workstations (see CodeGuide, which notify's you every 5 minutes that there is another computer on the network which use the same licence) :).

Author Comment

ID: 8245130
Thanks Ovi
  Case 2 is my requirement.
How can this be done.
Can you give me some links

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Accepted Solution

Ovi earned 200 total points
ID: 8245364

I have implemented such sequrity solutin, but unfortunatelly is company private. All you need to learn is in the above links, is very easy, and you should modify only the examples to get'it work. Anyway I can guide you if you have specific problems.

Expert Comment

ID: 8245799
You should be aware of the following:

Consider application instance 1. This will have both an emiter and a receiver. When the emiter will broadcast a message the receiver will receive'it too, even if is sended by the same application. So in other words, the receiver will identify localhost too as other instance. The solution to this is to send along with your data an emiterId. If the receiver is receiving an emiterId equal with the id of it's own emiter (the emiter of the same application instance) should ignore'it.

Expert Comment

ID: 8252208
Have you read the tutorials?

Author Comment

ID: 8252235
Thanks Ovi
   thanks a ton for all your support
   i am still going through the documents and let you know very soon.
I will need your support for developing solution

Expert Comment

ID: 9058354
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question