Finding an IP address using Java (was: do u know?)
Please support our Java advertiser: Programming Forums
![]() |
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
Tip:next time make your question clearer and make sure it makes sense
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. =\
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. =\
![]() |
Similar Threads
Other Threads in the Java Forum
- finding IP address (Java)
- Thinking OOP!: From BASIC to JAVA (Java)
- [MERGED] Ip Address (C++)
- help required for implementing project using JAVA & XML (Java)
Other Threads in the Java Forum
- Previous Thread: Full Screen
- Next Thread: tcp-ip programming
•
•
•
•
Views: 34011 | Replies: 3 | Currently Viewing: 1 (0 members and 1 guests)






Linear Mode