How to get IP Address of all PC through java program

prosun commented: i need help from this project +0

Recommended Answers

All 7 Replies

what do you mean for example i have a java script on one of my sites that tells the user visiting the site what there ip adress is. or are you trying to find all ur ip info cuz then you dont need a java program just goto run<cmd< type ipconfig all/. Or are u trying to build a java app that lets someone find ip info.


Tip:next time make your question clearer and make sure it makes sense

I tell you the way round ...

Process p = Runtime.Runtime().exec("ipconfig");

or just type another command for finding what computers are connected to your computer ( see net commands )

if you have linux or something .... write the commands over ipconfig.

The best way to obtain IP address is via the JDK's InetAddress
http://java.sun.com/j2se/1.4.2/docs/api/java/net/InetAddress.html#getLocalHost()

This returns InetAddress which has many goodies you can play around with.

For example, You can do things like reverse domain name loook ups on arbitrary ipaddresses... or ip addresses from hostnames.
http://www.cs.ucl.ac.uk/staff/sjiang/webpage/reverse-lookup-test.htm

By the way Nice Runtime Trick nanosani... it doesn't work if the host is running a secure classloader though... or another OS withouth ipconfig for that matter. =\

How to discover the local area network in java?

How to discover the local area network in java?

By reading above replies and not asking general questions...

How to find the class of an ip address? please provide me a code in java or c++.......

How to find the class of an ip address? please provide me a code in java or c++.......

Please read previous replies and in the future do not ask question in old thread that already have answer to it

If you have more specific questions then demanding code you are more then welcome to create new thread. As of now thread is closed

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.