bram_vg — 2011-02-19T07:03:24-05:00 — #1
I found several approaches that attempt to do this, but they either give me the external (regular) IP address, or they give 127.0.0.1 which doesn't really tell me anything. I need the local network address.
Just an alert saying "your machine's local network IP is 10.0.0.139" would be great.
felgall — 2011-02-19T16:28:08-05:00 — #2
bram_vg — 2011-02-21T03:31:16-05:00 — #3
Would you (or anyone else) have any idea how to go about this?? I'm really stuck with this...
I do have the latest Sun Java installed so that shouldn't be a problem.
allanp — 2011-02-22T02:20:31-05:00 — #4
bram_vg — 2011-02-22T02:54:40-05:00 — #5
Unfortunately this only gives the external (regular / global) IP, which is trivial.
I need their internal, local network IP, like "10.x.x.x" or "192.168.x.x", any idea how to get that?
felgall — 2011-02-22T02:58:30-05:00 — #6
I just tried that code and it did NOT give the correct IP address. It told me the IP address of my internet connection and not that of my computer. That's because it is using server side code to get the IP address - SSI in that example.
if (java && java.net)
ip = ''+java.net.InetAddress.getLocalHost().getHostAddress();
else ip = 'unknown';
Alternatively, I just found out that it is possible to do it entirely with Java - as http://www.proxyblind.org/javaipp.shtml demonstrates.