I searched the forum but got no solution. The walkie talkie example is close but it is wifi. The no-io example require my phonr connect to local wifi then go mobile network.
I have two 3g android phones and one php server. How can i apply apply Walkie talkie example via 3g network directly? Phone - 3g - internet - php server - internet - 3g - phone
Both phones can use icanhazip.com to get public ip.
In the walkie talkie example I use the internet ip (get from icanhazip.com) to make Connect Wifi but "trying to connect" then failed to connect.
Do I need to use another connection method? the following is the ConnectWifi that I passed internet ip
B4X:
Public Sub ConnectWifi(Ip As String)
socket1.Initialize("socket1")
socket1.Connect(Ip, port, 30000)
WifiStatus = "Trying to connect..."
UpdateUI
End Sub
If you want to avoid firewall issues, which can be a pain in the neck when on mobile devices, then the way round it is to have each device talking to the server, probably using port 80, rather than talking directly to each other. There's a small performance penalty, but it's not very high - you can still get pretty much real time communication.
I have a MySql-Database on a server. With httputils2 you can send the text, sender, receiver etc. to a php script which inserts it to the db. With f.e. a timer or on demand you can get those messages (Select message from xxxx where receiver = 'me').
So you never need to care about firewalls, ip addresses, etc.