I have an update. Unfortunately, I'm even more confused. The server all is configured as I describe above. I created a test application as I did above and it works. I put the code in a loop and it submits high scores every 5 seconds.
I then installed it on my Android phone and turned off Wi-Fi on my phone. And it worked! So, I thought I was home free.
I then added the function to my game. I copied the exact same function (which generated random high scores and submits) but it just does not connect. Exact same function code. One works and the other doesn't. Is there setting in my game that might prevent it from connecting like my sample app?
Here's the function I wrote to test:
do
SubmitScore()
loop
Function SubmitScore()
t# = timer()
do
iNetID = JoinNetwork("55.55.55.55", 4100, "Client"+str(Random()))
//iNetID = JoinNetwork("myNetwork", "Client"+str(Random()))
if iNetID > 1 then exit
if timer() - t# > 4.0
exit
endif
loop
c = 0
if iNetID > 0
// If we don't connect within 4 seconds, print an error and exit
t# = timer()
do
c = GetNetworkNumClients(iNetID)
if c > 1 then exit
if timer() - t# > 4.0
exit
endif
loop
endif
If c > 1
ServerID = GetNetworkServerID(iNetID)
newMsg = CreateNetworkMessage()
// Add the packet identifier
AddNetworkMessageFloat(newMsg, 1.1)
// Add the player's initials
AddNetworkMessageString(newMsg, "badkneecap")
// Add the player's score
AddNetworkMessageInteger(newMsg, Random(100, 5000))
// Add the player's level
AddNetworkMessageInteger(newMsg, Random(1, 15))
// Send it to the server
SendNetworkMessage(iNetID, ServerID, newMsg)
//CloseNetwork(iNetID)
endif
t# = timer()
do
if timer() - t# > 5.0
exit
endif
loop
if iNetID > 0
CloseNetwork(iNetID)
iNetID = 0
endif
EndFunction
In my game, I simply called the function to submit a random hight score, but it just does not want to connect. Does anyone have any idea why one app wound work and the other not? I'm running them both locally on my computer.