javamobilejava-meip-address

How do I get a public IP address of a mobile phone?


I want to connect my phone to a server using the internet using the server's IP address. Mobile phone's IP address are normally private as far as I came to know.. To make my app work, I need a public IP address of my phone. How do I achieve that?


Solution

  • You'll have to wait for IPv6 ;) Now you get private address and the your service provider does some address translation (NAT): The router has one single public IP and uses ports to map incoming messages to IP addresses of the private network.

    Your mobile's IP is invisible to the internet and the networks public IP is useless, because it is the router's address. Maybe with IPv6 we have public IPs for all mobiles, but for now you'll have to find a different solution for your problem - public IP doesn't work with mobiles as with all other clients in private networks (behind routers).