| | |
Finding an IP address using Java (was: do u know?)
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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
- Printing Memory Address in Java? (Java)
- finding IP address (Java)
- finding the length in java (Computer Science)
- [MERGED] Ip Address (C++)
Other Threads in the Java Forum
- Previous Thread: Full Screen
- Next Thread: tcp-ip programming
Views: 38871 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Java
911 addressbook android api append apple applet application arguments array arrays automation binary bluetooth character chat class classes client code component csv database draw eclipse error event exception file fractal ftp game givemetehcodez graphics gui helpwithhomework html ide image input integer j2me japplet java javaarraylist javaprojects jmf jni jpanel julia linked linux list loop map method methods mobile netbeans newbie number object objects oracle oriented panel print printf problem program programming project projects recursion replaydirector reporting researchinmotion return robot rotatetext scanner screen se server set size sms socket sort sql stream string swing test threads time transfer tree ubuntu windows






