Hello fellow stackoverflowers!
I'm currently developing this app that should be able to communicate device-to-device. I found <a href="http://thinkandroid.wordpress.com/2010/03/27/incorporating-socket-programming-into-your-applications/" rel="nofollow">this</a> cool guide on how to use Socket for that kind of communication. And it worked! ..ish.
My problem is that it only works while the two devices is connected to the same Wi-Fi. Which sucks... So if device-A is the server & device-B is the client, and I use the internal-IP address (like, 192.168.1.blahblahbla), it works.
-That's awesome, then why're complaining bro?
Well, I want to be able to connect to device-A's external-IP, the real IP (like 94.254.blabla.blabla). So my question to you guys, is how do I do that? How can I do something that can make this happen?
All help will be appriciated, thanks in advance.
This is morelike a networking question, but the answer is that there's no difference. The only different thing you have to bare with is with a firewall protection. If you can connect to a device using private IPs and not public, this means there's something blocking your connection (probably a firewall or the router's firewall).
You have to make sure the port you're connecting on the destination device is not blocked for your connection. The rest is the same.