RSS Forums RSS

Finding an IP address using Java (was: do u know?)

Please support our Java advertiser: Programming Forums
Reply
Posts: 8
Reputation: adityabakle is an unknown quantity at this point 
Solved Threads: 0
adityabakle adityabakle is offline Offline
Newbie Poster

Finding an IP address using Java (was: do u know?)

  #1  
Aug 7th, 2004
How to get IP Address of all PC through java program
AddThis Social Bookmark Button
Reply With Quote  
Posts: 1,365
Reputation: mikeandike22 is an unknown quantity at this point 
Solved Threads: 17
Featured Blogger
mikeandike22's Avatar
mikeandike22 mikeandike22 is offline Offline
Nearly a Posting Virtuoso

Re: Finding an IP address using Java (was: do u know?)

  #2  
Aug 7th, 2004
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
My Daniweb Blog: This,That, and Everything Else (Blog contest winner)

GetFirefox!
GetOpera!






Reply With Quote  
Posts: 1,683
Reputation: nanosani is an unknown quantity at this point 
Solved Threads: 53
Colleague
nanosani's Avatar
nanosani nanosani is offline Offline
Unauthenticated Liar

Re: Finding an IP address using Java (was: do u know?)

  #3  
Aug 8th, 2004
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.
Reply With Quote  
Posts: 152
Reputation: cosi is an unknown quantity at this point 
Solved Threads: 1
cosi's Avatar
cosi cosi is offline Offline
Junior Poster

Re: Finding an IP address using Java (was: do u know?)

  #4  
Aug 10th, 2004
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...ookup-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. =\
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the Java Forum
Views: 34011 | Replies: 3 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 10:37 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC