tags:

views:

34

answers:

2

We are writing a HTTP based desktop application whose client runs from outside our NAT. We code and test from inside the NAT. The http server sits within our NAT (yes it is bad network design). What would be the best Java method for automatically detecting where the HTTP client is launching from and passing the appropriate server IP (i.e. NAT internal or External) ?

server_ip = 0.0.0.0
if(inside_nat())
   server_ip = 192.168.0.*
else
   server_ip = 202.13.14.15

Need a java implementation of insider_nat()

A: 

I don't think you can do that from within your java application. You can use a DNS name that would be resolved differently by the internal DNS server than the external (global) one.

Maurice Perry
A: 

We resolved this with a DNS entry in our Windows Small Business server (which is used as a local default DNS). The Java name to IP resolution is used to find the corresponding IP where port mapping is used and internal and external ports differ.

whatnick