InetAddress Question

Whenever I try to get the ip of my computer with InetAddress, it gives my local network ip of like 192.168.1.101. How do I get it to give my internet IP address?Thanks
[181 byte] By [Nethera] at [2007-11-26 18:49:42]
# 1

> Whenever I try to get the ip of my computer with

> InetAddress, it gives my local network ip of like

> 192.168.1.101. How do I get it to give my internet

> IP address?

>

> Thanks

Read this:

http://forum.java.sun.com/thread.jspa?threadID=727490

prometheuzza at 2007-7-9 6:23:44 > top of Java-index,Java Essentials,Java Programming...
# 2

> > Whenever I try to get the ip of my computer with

> > InetAddress, it gives my local network ip of like

> > 192.168.1.101. How do I get it to give my

> internet

> > IP address?

> >

> > Thanks

>

> Read this:

> http://forum.java.sun.com/thread.jspa?threadID=727490

Thats pretty cool. I didn't think you could do that. I guess really it is just reading the HTML source but still I didn't think it possible. Could be pretty useful.

kikemellya at 2007-7-9 6:23:44 > top of Java-index,Java Essentials,Java Programming...
# 3

> How do I get it to give my internet

> IP address?

You might not have one. If your router or firewall has a pulic IP address and is doing port forwarding or NAT (I'm a little fuzzy on the distinction--I think port forwarding is one way to do NAT, but don't quote me on that), as described in the thread that prom linked to, then (assuming you cotrol the router/firewall) you can forward the desired ports to 192.168.1.101 and use the router's public IP as if it were your computer's for those ports. Else you're SOL.

jverda at 2007-7-9 6:23:44 > top of Java-index,Java Essentials,Java Programming...
# 4
I, like the person in the other post, have a master server which gives out the ip addresses of servers for a game I'm making. It seems to me that the best way is to do the whatismyip.com trick, but that doesn't seem very stable. I didn't really understand any other solutions.
Nethera at 2007-7-9 6:23:44 > top of Java-index,Java Essentials,Java Programming...
# 5
> ...> but that doesn't seem very stable.> ...That is correct.
prometheuzza at 2007-7-9 6:23:44 > top of Java-index,Java Essentials,Java Programming...